aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust2013-04-30 11:43:42 -0500
committerGreg Kroah-Hartman2013-05-11 15:54:10 -0500
commit76e7f478a400a76a37a05848cc2e9263e0d0cb40 (patch)
tree69a0fbd8caa5de771223f8477f0c38c3c25efcd3
parent5a3f1f30a22ab33f948f0c4a6d56fc7cc5df5199 (diff)
downloadkernel-omap-76e7f478a400a76a37a05848cc2e9263e0d0cb40.tar.gz
kernel-omap-76e7f478a400a76a37a05848cc2e9263e0d0cb40.tar.xz
kernel-omap-76e7f478a400a76a37a05848cc2e9263e0d0cb40.zip
NFSv4.x: Fix handling of partially delegated locks
commit c5a2a15f8146fdfe45078df7873a6dc1006b3869 upstream. 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@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Tested-by: Chuck Lever <Chuck.Lever@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/nfs/nfs4proc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 51d53a47a456..e3c6121bdf02 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4513,9 +4513,9 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
4513 if (status != 0) 4513 if (status != 0)
4514 goto out; 4514 goto out;
4515 /* Is this a delegated lock? */ 4515 /* Is this a delegated lock? */
4516 if (test_bit(NFS_DELEGATED_STATE, &state->flags))
4517 goto out;
4518 lsp = request->fl_u.nfs4_fl.owner; 4516 lsp = request->fl_u.nfs4_fl.owner;
4517 if (test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) == 0)
4518 goto out;
4519 seqid = nfs_alloc_seqid(&lsp->ls_seqid, GFP_KERNEL); 4519 seqid = nfs_alloc_seqid(&lsp->ls_seqid, GFP_KERNEL);
4520 status = -ENOMEM; 4520 status = -ENOMEM;
4521 if (seqid == NULL) 4521 if (seqid == NULL)