aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/lockd/svclock.c25
-rw-r--r--include/linux/lockd/lockd.h10
2 files changed, 35 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 */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index ac25b5649c59..d4c4de753bca 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -119,6 +119,9 @@ struct nlm_file {
119 * couldn't be granted because of a conflicting lock). 119 * couldn't be granted because of a conflicting lock).
120 */ 120 */
121#define NLM_NEVER (~(unsigned long) 0) 121#define NLM_NEVER (~(unsigned long) 0)
122/* timeout on non-blocking call: */
123#define NLM_TIMEOUT (7 * HZ)
124
122struct nlm_block { 125struct nlm_block {
123 struct kref b_count; /* Reference count */ 126 struct kref b_count; /* Reference count */
124 struct list_head b_list; /* linked list of all blocks */ 127 struct list_head b_list; /* linked list of all blocks */
@@ -130,6 +133,13 @@ struct nlm_block {
130 unsigned int b_id; /* block id */ 133 unsigned int b_id; /* block id */
131 unsigned char b_granted; /* VFS granted lock */ 134 unsigned char b_granted; /* VFS granted lock */
132 struct nlm_file * b_file; /* file in question */ 135 struct nlm_file * b_file; /* file in question */
136 struct cache_req * b_cache_req; /* deferred request handling */
137 struct file_lock * b_fl; /* set for GETLK */
138 struct cache_deferred_req * b_deferred_req;
139 unsigned int b_flags; /* block flags */
140#define B_QUEUED 1 /* lock queued */
141#define B_GOT_CALLBACK 2 /* got lock or conflicting lock */
142#define B_TIMED_OUT 4 /* filesystem too slow to respond */
133}; 143};
134 144
135/* 145/*