Re: [PATCH 1/2] NFSv4.x: Fix handling of partially delegated locks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi-

On May 2, 2013, at 1:19 PM, Trond Myklebust <Trond.Myklebust@xxxxxxxxxx> wrote:

> If a NFS client receives a delegation for a file after it has taken
> a lock on that file, we can currently end up in a situation where
> we mistakenly skip unlocking that file.
> 
> The following patch swaps an erroneous check in nfs4_proc_unlck for
> whether or not the file has a delegation to one which checks whether
> or not we hold a lock stateid for that file.
> 
> Reported-by: Chuck Lever <Chuck.Lever@xxxxxxxxxx>
> Signed-off-by: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx

Although this patch may apply cleanly to, say, 3.0-stable, the result is that LOCKUs now never appear on the wire.  It seems that older stable kernels are missing something that is needed to make this simple fix work correctly.


> Tested-by: Chuck Lever <Chuck.Lever@xxxxxxxxxx>
> ---
> fs/nfs/nfs4proc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 9da4bd5..dc1da2a 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -4766,9 +4766,9 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
> 	if (status != 0)
> 		goto out;
> 	/* Is this a delegated lock? */
> -	if (test_bit(NFS_DELEGATED_STATE, &state->flags))
> -		goto out;
> 	lsp = request->fl_u.nfs4_fl.owner;
> +	if (test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) == 0)
> +		goto out;
> 	seqid = nfs_alloc_seqid(&lsp->ls_seqid, GFP_KERNEL);
> 	status = -ENOMEM;
> 	if (seqid == NULL)
> -- 
> 1.8.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Chuck Lever
chuck[dot]lever[at]oracle[dot]com




--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux