From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757684AbdJKQrC (ORCPT ); Wed, 11 Oct 2017 12:47:02 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:58262 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757597AbdJKQq7 (ORCPT ); Wed, 11 Oct 2017 12:46:59 -0400 Date: Wed, 11 Oct 2017 17:46:49 +0100 From: Al Viro To: "Levin, Alexander (Sasha Levin)" Cc: "ericvh@gmail.com" , "rminnich@sandia.gov" , "lucho@ionkov.net" , "torvalds@linux-foundation.org" , "v9fs-developer@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" , "jack@suse.com" Subject: Re: [PATCH] 9p: set page uptodate when required in write_end() Message-ID: <20171011164649.GA21978@ZenIV.linux.org.uk> References: <20170410184657.13430-1-alexander.levin@verizon.com> <20170602023109.4sr6zz4dgh3e6syn@sasha-lappy> <20171011122741.doojezq3fe4iyg73@sasha-lappy> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171011122741.doojezq3fe4iyg73@sasha-lappy> User-Agent: Mutt/1.9.0 (2017-09-02) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.