aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svclock.c
diff options
context:
space:
mode:
authorMarc Eshel <eshel@almaden.ibm.com>2006-11-28 16:26:47 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2007-05-06 20:38:50 -0400
commit2b36f412ab6f2e5b64af9832b20eb7ef67d025b4 (patch)
treeb4a561cc944d25d96798f97d06bd78760db7afba /fs/lockd/svclock.c
parent2beb6614f5e36c6165b704c167d82ef3e4ceaa0c (diff)
lockd: save lock state on deferral
We need to keep some state for a pending asynchronous lock request, so this patch adds that state to struct nlm_block. This also adds a function which defers the request, by calling rqstp->rq_chandle.defer and storing the resulting deferred request in a nlm_block structure which we insert into lockd's global block list. That new function isn't called yet, so it's dead code until a later patch. Signed-off-by: Marc Eshel <eshel@almaden.ibm.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/lockd/svclock.c')
-rw-r--r--fs/lockd/svclock.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 3b0e7a4b817b..f2449265e2eb 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -331,6 +331,31 @@ static void nlmsvc_freegrantargs(struct nlm_rqst *call)
331} 331}
332 332
333/* 333/*
334 * Deferred lock request handling for non-blocking lock
335 */
336static u32
337nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block)
338{
339 u32 status = nlm_lck_denied_nolocks;
340
341 block->b_flags |= B_QUEUED;
342
343 nlmsvc_insert_block(block, NLM_TIMEOUT);
344
345 block->b_cache_req = &rqstp->rq_chandle;
346 if (rqstp->rq_chandle.defer) {
347 block->b_deferred_req =
348 rqstp->rq_chandle.defer(block->b_cache_req);
349 if (block->b_deferred_req != NULL)
350 status = nlm_drop_reply;
351 }
352 dprintk("lockd: nlmsvc_defer_lock_rqst block %p flags %d status %d\n",
353 block, block->b_flags, status);
354
355 return status;
356}
357
358/*
334 * Attempt to establish a lock, and if it can't be granted, block it 359 * Attempt to establish a lock, and if it can't be granted, block it
335 * if required. 360 * if required.
336 */ 361 */