From patchwork Mon Apr 10 18:46:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander" X-Patchwork-Id: 9673991 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2852B60244 for ; Mon, 10 Apr 2017 18:47:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EBB828489 for ; Mon, 10 Apr 2017 18:47:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11A952848D; Mon, 10 Apr 2017 18:47:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7E7D728489 for ; Mon, 10 Apr 2017 18:47:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1cxeLf-0002Ce-K9; Mon, 10 Apr 2017 18:47:35 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1cxeLe-0002CU-BQ for v9fs-developer@lists.sourceforge.net; Mon, 10 Apr 2017 18:47:34 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of verizon.com designates 199.249.25.208 as permitted sender) client-ip=199.249.25.208; envelope-from=alexander.levin@verizon.com; helo=omzsmtpe03.verizonbusiness.com; Received: from omzsmtpe03.verizonbusiness.com ([199.249.25.208]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1cxeLd-0006zd-0F for v9fs-developer@lists.sourceforge.net; Mon, 10 Apr 2017 18:47:34 +0000 X-IronPort-Anti-Spam-Filtered: false Received: from unknown (HELO fldsmtpi03.verizon.com) ([166.68.71.145]) by omzsmtpe03.verizonbusiness.com with ESMTP; 10 Apr 2017 18:47:27 +0000 X-IronPort-AV: E=Sophos;i="5.37,182,1488844800"; d="scan'208";a="330542566" Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO apollo.verizonwireless.com) ([10.255.192.101]) by fldsmtpi03.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Apr 2017 18:46:54 +0000 Received: from challenger.odc.vzwcorp.com (HELO mercury.verizonwireless.com) ([10.255.240.24]) by apollo.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Apr 2017 14:46:53 -0400 From: alexander.levin@verizon.com X-Host: challenger.odc.vzwcorp.com Received: from nyora1hub004.uswin.ad.vzwcorp.com ([10.170.34.219]) by mercury.verizonwireless.com with ESMTP/TLS/AES256-SHA; 10 Apr 2017 18:46:53 +0000 Received: from OMZP1LUMXCA16.uswin.ad.vzwcorp.com (144.8.22.194) by NYORA1HUB004.uswin.ad.vzwcorp.com (10.170.34.219) with Microsoft SMTP Server (TLS) id 8.3.406.0; Mon, 10 Apr 2017 14:46:53 -0400 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA16.uswin.ad.vzwcorp.com (144.8.22.194) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 10 Apr 2017 13:46:51 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1210.000; Mon, 10 Apr 2017 13:46:51 -0500 To: "ericvh@gmail.com" , "rminnich@sandia.gov" , "lucho@ionkov.net" Thread-Topic: [PATCH] 9p: set page uptodate when required in write_end() Thread-Index: AQHSsirRaZAdjOarXE+CQy9Z9zTlZA== Date: Mon, 10 Apr 2017 18:46:51 +0000 Message-ID: <20170410184657.13430-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 X-Headers-End: 1cxeLd-0006zd-0F Cc: "v9fs-developer@lists.sourceforge.net" , alexander.levin@verizon.com, "linux-kernel@vger.kernel.org" , "viro@zeniv.linux.org.uk" , "jack@suse.com" Subject: [V9fs-developer] [PATCH] 9p: set page uptodate when required in write_end() X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Virus-Scanned: ClamAV using ClamSMTP From: Alexander Levin 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 Signed-off-by: Alexander Levin --- fs/9p/vfs_addr.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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); + } } /* * No need to use i_size_read() here, the i_size