All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFSv4.1: new layout stateid can not be overwrite by one out of date
@ 2014-01-20  8:15 shaobingqing
  2014-01-20 23:23 ` Trond Myklebust
  0 siblings, 1 reply; 2+ messages in thread
From: shaobingqing @ 2014-01-20  8:15 UTC (permalink / raw)
  To: trond.myklebust; +Cc: linux-nfs, linux-kernel, shaobingqing

If initiate_file_draining returned NFS4ERR_DELAY, all the lsegs of
a file might be released before the retrying cb_layout request arriving
at the client. In this situation, layoutget request of the file will
use open stateid to obtain a new layout stateid. And if the retrying
cb_layout request arrived at the client after the layoutget reply,
new layout stateid would be overwrite by one out of date.

Signed-off-by: shaobingqing <shaobingqing@bwstor.com.cn>
---
 fs/nfs/callback_proc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index ae2e87b..98fed13 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -174,7 +174,9 @@ static u32 initiate_file_draining(struct nfs_client *clp,
 		rv = NFS4ERR_DELAY;
 	else
 		rv = NFS4ERR_NOMATCHING_LAYOUT;
-	pnfs_set_layout_stateid(lo, &args->cbl_stateid, true);
+	if (memcmp(args->cbl_stateid.other, lo->plh_stateid.other,
+	     NFS4_STATEID_OTHER_SIZE) == 0)
+		pnfs_set_layout_stateid(lo, &args->cbl_stateid, true);
 	spin_unlock(&ino->i_lock);
 	pnfs_free_lseg_list(&free_me_list);
 	pnfs_put_layout_hdr(lo);
-- 
1.7.4.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] NFSv4.1: new layout stateid can not be overwrite by one out of date
  2014-01-20  8:15 [PATCH] NFSv4.1: new layout stateid can not be overwrite by one out of date shaobingqing
@ 2014-01-20 23:23 ` Trond Myklebust
  0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2014-01-20 23:23 UTC (permalink / raw)
  To: shaobingqing; +Cc: linux-nfs, linux-kernel

On Mon, 2014-01-20 at 16:15 +0800, shaobingqing wrote:
> If initiate_file_draining returned NFS4ERR_DELAY, all the lsegs of
> a file might be released before the retrying cb_layout request arriving
> at the client. In this situation, layoutget request of the file will
> use open stateid to obtain a new layout stateid. And if the retrying
> cb_layout request arrived at the client after the layoutget reply,
> new layout stateid would be overwrite by one out of date.
> 
> Signed-off-by: shaobingqing <shaobingqing@bwstor.com.cn>
> ---
>  fs/nfs/callback_proc.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
> index ae2e87b..98fed13 100644
> --- a/fs/nfs/callback_proc.c
> +++ b/fs/nfs/callback_proc.c
> @@ -174,7 +174,9 @@ static u32 initiate_file_draining(struct nfs_client *clp,
>  		rv = NFS4ERR_DELAY;
>  	else
>  		rv = NFS4ERR_NOMATCHING_LAYOUT;
> -	pnfs_set_layout_stateid(lo, &args->cbl_stateid, true);
> +	if (memcmp(args->cbl_stateid.other, lo->plh_stateid.other,
> +	     NFS4_STATEID_OTHER_SIZE) == 0)
> +		pnfs_set_layout_stateid(lo, &args->cbl_stateid, true);

Well...  We shouldn't really be calling
pnfs_mark_matching_lsegs_invalid() either in this case...

>  	spin_unlock(&ino->i_lock);
>  	pnfs_free_lseg_list(&free_me_list);
>  	pnfs_put_layout_hdr(lo);


-- 
Trond Myklebust
Linux NFS client maintainer


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-20 23:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-20  8:15 [PATCH] NFSv4.1: new layout stateid can not be overwrite by one out of date shaobingqing
2014-01-20 23:23 ` Trond Myklebust

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.