From patchwork Mon Jan 13 07:55:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaobingqing X-Patchwork-Id: 3473891 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 817E0C02DC for ; Mon, 13 Jan 2014 08:04:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 68FD420122 for ; Mon, 13 Jan 2014 08:04:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63E3720121 for ; Mon, 13 Jan 2014 08:04:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751360AbaAMIE1 (ORCPT ); Mon, 13 Jan 2014 03:04:27 -0500 Received: from mx.nrchpc.ac.cn ([211.103.180.228]:37993 "EHLO mx.bwstor.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751526AbaAMIDV (ORCPT ); Mon, 13 Jan 2014 03:03:21 -0500 X-Greylist: delayed 389 seconds by postgrey-1.27 at vger.kernel.org; Mon, 13 Jan 2014 03:03:20 EST Received: from localhost (localhost [127.0.0.1]) by mx.bwstor.cn (Postfix) with ESMTP id 69390E2202; Mon, 13 Jan 2014 15:56:44 +0800 (CST) Received: from mx.bwstor.cn ([127.0.0.1]) by localhost (mx2.bwstor.com.cn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yBDfC3i23qt1; Mon, 13 Jan 2014 15:56:44 +0800 (CST) Received: from linux-odmv.site (unknown [10.10.37.58]) by mx.bwstor.cn (Postfix) with ESMTPA id 54808E21FD; Mon, 13 Jan 2014 15:56:44 +0800 (CST) From: shaobingqing To: Trond.Myklebust@netapp.com Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, shaobingqing Subject: [PATCH] nfs: don't update isize when NFS_INO_LAYOUTCOMMITTING in nfs_update_inode Date: Mon, 13 Jan 2014 15:55:59 +0800 Message-Id: <1389599759-2711-1-git-send-email-shaobingqing@bwstor.com.cn> X-Mailer: git-send-email 1.7.4.2 In-Reply-To: References: Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When a file is in NFS_INO_LAYOUTCOMMITING status, its isize perhaps has not been transferred to the metadate server. So the isize getting from the metadata server perhaps is out of date and cannot be used to update the isize of the client. Signed-off-by: shaobingqing --- fs/nfs/inode.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index ebeb94c..caf50a1 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1402,7 +1402,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) if (new_isize != cur_isize) { /* Do we perhaps have any outstanding writes, or has * the file grown beyond our last write? */ - if ((nfsi->npages == 0 && !test_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags)) || + if ((nfsi->npages == 0 && !test_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags) && + !test_bit(NFS_INO_LAYOUTCOMMITTING, &nfsi->flags)) || new_isize > cur_isize) { i_size_write(inode, new_isize); invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;