public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@primarydata.com>
To: shaobingqing <shaobingqing@bwstor.com.cn>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nfs: don't update isize when NFS_INO_LAYOUTCOMMITTING in nfs_update_inode
Date: Mon, 13 Jan 2014 08:34:54 -0500	[thread overview]
Message-ID: <C689DB34-AC0A-49CF-94DC-74ACB1CB177F@primarydata.com> (raw)
In-Reply-To: <1389599759-2711-1-git-send-email-shaobingqing@bwstor.com.cn>


On Jan 13, 2014, at 2:55, shaobingqing <shaobingqing@bwstor.com.cn> wrote:

> 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;

Ugh. Is there any reason why we can’t just keep NFS_INO_LAYOUTCOMMIT set until the layout commit operation is finished instead of multiplying the tests for it in generic NFS code paths such as nfs_update_inode?

--
Trond Myklebust
Linux NFS client maintainer


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

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13  7:55 [PATCH] nfs: don't update isize when NFS_INO_LAYOUTCOMMITTING in nfs_update_inode shaobingqing
2014-01-13 13:34 ` Trond Myklebust [this message]
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=C689DB34-AC0A-49CF-94DC-74ACB1CB177F@primarydata.com \
    --to=trond.myklebust@primarydata.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=shaobingqing@bwstor.com.cn \
    /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