9p: set page uptodate when required in write_end()
authorAlexander Levin <alexander.levin@verizon.com>
Mon, 10 Apr 2017 18:46:51 +0000 (18:46 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Oct 2017 16:30:08 +0000 (09:30 -0700)
Commit 77469c3f570 prevented setting the page as uptodate when we wrote
the right amount of data, fix that.

Fixes: 77469c3f570 ("9p: saner ->write_end() on failing copy into non-uptodate page")
Reviewed-by: Jan Kara <jack@suse.com>
Signed-off-by: Alexander Levin <alexander.levin@verizon.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/9p/vfs_addr.c

index adaf6f6dd858cb9b0a6b0077782d068b3d024e0b..e1cbdfdb7c684fd24fdb6f25ee03f4e253e9ef58 100644 (file)
@@ -310,9 +310,13 @@ static int v9fs_write_end(struct file *filp, struct address_space *mapping,
 
        p9_debug(P9_DEBUG_VFS, "filp %p, mapping %p\n", filp, mapping);
 
-       if (unlikely(copied < len && !PageUptodate(page))) {
-               copied = 0;
-               goto out;
+       if (!PageUptodate(page)) {
+               if (unlikely(copied < len)) {
+                       copied = 0;
+                       goto out;
+               } else if (len == PAGE_SIZE) {
+                       SetPageUptodate(page);
+               }
        }
        /*
         * No need to use i_size_read() here, the i_size