[pnfs] [PATCH 9/9] pnfs client prevent race in sequence slot

Trond Myklebust trond.myklebust at fys.uio.no
Wed Sep 26 12:50:08 EDT 2007


On Wed, 2007-09-26 at 08:45 -0400, andros at umich.edu wrote:
> From: Andy Adamson <andros at umich.edu>
> 
> Move the lock to cover reading the sequence list in rpc_sequence
> which allowed multiple rpc's to be in flight with the same slot
> sequence id.

Sorry. This patch is just wrong. There is no reason to take the spinlock
when just testing for equality here.

Trond

> Signed-off by: Andy Adamson<andros at umich.edu>
> ---
>  fs/nfs/nfs4state.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
> index 4963454..cbc08af 100644
> --- a/fs/nfs/nfs4state.c
> +++ b/fs/nfs/nfs4state.c
> @@ -773,15 +773,15 @@ int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task)
>  	struct rpc_sequence *sequence = seqid->sequence->sequence;
>  	int status = 0;
>  
> +	spin_lock(&sequence->lock);
>  	if (sequence->list.next == &seqid->list)
>  		goto out;
> -	spin_lock(&sequence->lock);
>  	if (sequence->list.next != &seqid->list) {
>  		rpc_sleep_on(&sequence->wait, task, NULL, NULL);
>  		status = -EAGAIN;
>  	}
> -	spin_unlock(&sequence->lock);
>  out:
> +	spin_unlock(&sequence->lock);
>  	return status;
>  }
>  



More information about the pNFS mailing list