Messages in this thread Patch in this message | | | Date | Wed, 11 Oct 2017 17:46:49 +0100 | From | Al Viro <> | Subject | Re: [PATCH] 9p: set page uptodate when required in write_end() |
| |
On Wed, Oct 11, 2017 at 12:27:43PM +0000, Levin, Alexander (Sasha Levin) wrote: > >> diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c > >> index adaf6f6..e1cbdfd 100644 > >> --- a/fs/9p/vfs_addr.c > >> +++ b/fs/9p/vfs_addr.c > >> @@ -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); > >> + }
Umm... I'm not sure I like it in that form. Look: to get here we need to successfully pass through ->write_begin(). Which means that we either have returned with PageUptodate(page) or had hit len == PAGE_SIZE && !PageUptodate(page). Case of non-uptodate with len < PAGE_SIZE is handled by forcing readpage and repeating the entire thing.
So the only way to get !PageUptodate(page) in ->write_end() is to have had len == PAGE_SIZE. It needs a comment, at the very least.
| |