Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:37462 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751435AbbIZG0s (ORCPT ); Sat, 26 Sep 2015 02:26:48 -0400 Subject: Patch "NFSv4/pnfs: Ensure we don't miss a file extension" has been added to the 4.1-stable tree To: trond.myklebust@primarydata.com, gregkh@linuxfoundation.org, tao.peng@primarydata.com Cc: , From: Date: Fri, 25 Sep 2015 20:48:57 -0700 Message-ID: <1443239337108120@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled NFSv4/pnfs: Ensure we don't miss a file extension to the 4.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: nfsv4-pnfs-ensure-we-don-t-miss-a-file-extension.patch and it can be found in the queue-4.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From 2b83d3de4c18af49800e0b26ae013db4fcf43a4a Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Sun, 5 Jul 2015 20:06:38 -0400 Subject: NFSv4/pnfs: Ensure we don't miss a file extension From: Trond Myklebust commit 2b83d3de4c18af49800e0b26ae013db4fcf43a4a upstream. pNFS writes don't return attributes, however that doesn't mean that we should ignore the fact that they may be extending the file. This patch ensures that if a write is seen to extend the file, then we always set an attribute barrier, and update the cached file size. Signed-off-by: Trond Myklebust Cc: Peng Tao Signed-off-by: Greg Kroah-Hartman --- fs/nfs/write.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1383,24 +1383,27 @@ static void nfs_writeback_check_extend(s { struct nfs_pgio_args *argp = &hdr->args; struct nfs_pgio_res *resp = &hdr->res; + u64 size = argp->offset + resp->count; if (!(fattr->valid & NFS_ATTR_FATTR_SIZE)) + fattr->size = size; + if (nfs_size_to_loff_t(fattr->size) < i_size_read(hdr->inode)) { + fattr->valid &= ~NFS_ATTR_FATTR_SIZE; return; - if (argp->offset + resp->count != fattr->size) - return; - if (nfs_size_to_loff_t(fattr->size) < i_size_read(hdr->inode)) + } + if (size != fattr->size) return; /* Set attribute barrier */ nfs_fattr_set_barrier(fattr); + /* ...and update size */ + fattr->valid |= NFS_ATTR_FATTR_SIZE; } void nfs_writeback_update_inode(struct nfs_pgio_header *hdr) { - struct nfs_fattr *fattr = hdr->res.fattr; + struct nfs_fattr *fattr = &hdr->fattr; struct inode *inode = hdr->inode; - if (fattr == NULL) - return; spin_lock(&inode->i_lock); nfs_writeback_check_extend(hdr, fattr); nfs_post_op_update_inode_force_wcc_locked(inode, fattr); Patches currently in stable-queue which might be from trond.myklebust@primarydata.com are queue-4.1/nfs-don-t-let-the-ctime-override-attribute-barriers.patch queue-4.1/nfsv4-don-t-set-setattr-for-o_rdonly-o_excl.patch queue-4.1/nfsv4.1-pnfs-fix-borken-function-_same_data_server_addrs_locked.patch queue-4.1/nfsv4-pnfs-ensure-we-don-t-miss-a-file-extension.patch