mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: shaobingqing <shaobingqing@bwstor.com.cn>
To: Trond.Myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	shaobingqing <shaobingqing@bwstor.com.cn>
Subject: [PATCH] nfs: don't update isize when NFS_INO_LAYOUTCOMMITTING in nfs_update_inode
Date: Mon, 13 Jan 2014 15:55:59 +0800	[thread overview]
Message-ID: <1389599759-2711-1-git-send-email-shaobingqing@bwstor.com.cn> (raw)
In-Reply-To: <n>

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 <shaobingqing@bwstor.com.cn>
---
 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;
-- 
1.7.4.2


             reply	other threads:[~2014-01-13  8:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13  7:55 shaobingqing [this message]
2014-01-13 13:34 ` Trond Myklebust
2014-01-13 16:28   ` Trond Myklebust
2014-01-13 18:45     ` [PATCH 1/2] NFSv4.1: Don't trust attributes if a pNFS LAYOUTCOMMIT is outstanding Trond Myklebust
2014-01-13 18:45     ` [PATCH 2/2] NFSv4.1: Fix a race in nfs4_write_inode Trond Myklebust
2014-01-16 15:49       ` Peng Tao
2014-01-16 17:11         ` Trond Myklebust
2014-01-17 13:05           ` Peng Tao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389599759-2711-1-git-send-email-shaobingqing@bwstor.com.cn \
    --to=shaobingqing@bwstor.com.cn \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®