aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svcproc.c
diff options
context:
space:
mode:
authorMarc Eshel <eshel@almaden.ibm.com>2006-11-28 16:27:06 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2007-05-06 20:38:50 -0400
commit5ea0d75037b93baa453b4d326c6319968fe91cea (patch)
tree661d15750a689daec2dca0f81a16c75a930df741 /fs/lockd/svcproc.c
parent85f3f1b3f7a6197b51a2ab98d927517df730214c (diff)
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/svcproc.c')
-rw-r--r--fs/lockd/svcproc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index d13b827dfd34..40b5cf496b51 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -33,6 +33,7 @@ cast_to_nlm(__be32 status, u32 vers)
33 case nlm_lck_denied_nolocks: 33 case nlm_lck_denied_nolocks:
34 case nlm_lck_blocked: 34 case nlm_lck_blocked:
35 case nlm_lck_denied_grace_period: 35 case nlm_lck_denied_grace_period:
36 case nlm_drop_reply:
36 break; 37 break;
37 case nlm4_deadlock: 38 case nlm4_deadlock:
38 status = nlm_lck_denied; 39 status = nlm_lck_denied;
@@ -128,6 +129,8 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
128 129
129 /* Now check for conflicting locks */ 130 /* Now check for conflicting locks */
130 resp->status = cast_status(nlmsvc_testlock(rqstp, file, &argp->lock, &resp->lock, &resp->cookie)); 131 resp->status = cast_status(nlmsvc_testlock(rqstp, file, &argp->lock, &resp->lock, &resp->cookie));
132 if (resp->status == nlm_drop_reply)
133 return rpc_drop_reply;
131 134
132 dprintk("lockd: TEST status %d vers %d\n", 135 dprintk("lockd: TEST status %d vers %d\n",
133 ntohl(resp->status), rqstp->rq_vers); 136 ntohl(resp->status), rqstp->rq_vers);