summaryrefslogtreecommitdiffstats
path: root/fs/lockd/svc4proc.c
diff options
context:
space:
mode:
authorMarc Eshel2006-11-28 22:27:06 +0100
committerJ. Bruce Fields2007-05-07 02:38:50 +0200
commit5ea0d75037b93baa453b4d326c6319968fe91cea (patch)
tree661d15750a689daec2dca0f81a16c75a930df741 /fs/lockd/svc4proc.c
parentlockd: pass cookie in nlmsvc_testlock (diff)
downloadkernel-qcow2-linux-5ea0d75037b93baa453b4d326c6319968fe91cea.tar.gz
kernel-qcow2-linux-5ea0d75037b93baa453b4d326c6319968fe91cea.tar.xz
kernel-qcow2-linux-5ea0d75037b93baa453b4d326c6319968fe91cea.zip
lockd: handle test_lock deferrals
Rewrite nlmsvc_testlock() to use the new asynchronous interface: instead of immediately doing a posix_test_lock(), we first look for a matching block. If the subsequent test_lock returns anything other than -EINPROGRESS, we then remove the block we've found and return the results. If it returns -EINPROGRESS, then we defer the lock request. In the case where the block we find in the first step has B_QUEUED set, we bypass the vfs_test_lock entirely, instead using the block to decide how to respond: with nlm_lck_denied if B_TIMED_OUT is set. with nlm_granted if B_GOT_CALLBACK is set. by dropping if neither B_TIMED_OUT nor B_GOT_CALLBACK is set Signed-off-by: Marc Eshel <eshel@almaden.ibm.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/lockd/svc4proc.c')
-rw-r--r--fs/lockd/svc4proc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index a1bccad7ebd3..205d8befbf1b 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -100,6 +100,8 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
/* Now check for conflicting locks */
resp->status = nlmsvc_testlock(rqstp, file, &argp->lock, &resp->lock, &resp->cookie);
+ if (resp->status == nlm_drop_reply)
+ return rpc_drop_reply;
dprintk("lockd: TEST4 status %d\n", ntohl(resp->status));
nlm_release_host(host);