Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938863AbcKNDEV (ORCPT ); Sun, 13 Nov 2016 22:04:21 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:46282 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754246AbcKNCF7 (ORCPT ); Sun, 13 Nov 2016 21:05:59 -0500 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Alexey Dobriyan" , "Benjamin Coddington" , "Trond Myklebust" , "Weston Andros Adamson" Date: Mon, 14 Nov 2016 00:14:07 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 037/152] nfs: don't create zero-length requests In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1501 Lines: 43 3.2.84-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Benjamin Coddington commit 149a4fddd0a72d526abbeac0c8deaab03559836a upstream. NFS doesn't expect requests with wb_bytes set to zero and may make unexpected decisions about how to handle that request at the page IO layer. Skip request creation if we won't have any wb_bytes in the request. Signed-off-by: Benjamin Coddington Signed-off-by: Alexey Dobriyan Reviewed-by: Weston Andros Adamson Signed-off-by: Trond Myklebust [bwh: Backported to 3.2: adjust context] Signed-off-by: Ben Hutchings --- fs/nfs/write.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -747,6 +747,9 @@ int nfs_updatepage(struct file *file, st file->f_path.dentry->d_name.name, count, (long long)(page_offset(page) + offset)); + if (!count) + goto out; + /* If we're not using byte range locks, and we know the page * is up to date, it may be more efficient to extend the write * to cover the entire page in order to avoid fragmentation @@ -764,7 +767,7 @@ int nfs_updatepage(struct file *file, st nfs_set_pageerror(page); else __set_page_dirty_nobuffers(page); - +out: dprintk("NFS: nfs_updatepage returns %d (isize %lld)\n", status, (long long)i_size_read(inode)); return status;