Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54493
b: refs/heads/master
c: 2b36f41
h: refs/heads/master
i:
  54491: 94e58f4
v: v3
  • Loading branch information
Marc Eshel authored and J. Bruce Fields committed May 7, 2007
1 parent 5b81a81 commit fcc042b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2beb6614f5e36c6165b704c167d82ef3e4ceaa0c
refs/heads/master: 2b36f412ab6f2e5b64af9832b20eb7ef67d025b4
25 changes: 25 additions & 0 deletions trunk/fs/lockd/svclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,31 @@ static void nlmsvc_freegrantargs(struct nlm_rqst *call)
kfree(call->a_args.lock.oh.data);
}

/*
* Deferred lock request handling for non-blocking lock
*/
static u32
nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block)
{
u32 status = nlm_lck_denied_nolocks;

block->b_flags |= B_QUEUED;

nlmsvc_insert_block(block, NLM_TIMEOUT);

block->b_cache_req = &rqstp->rq_chandle;
if (rqstp->rq_chandle.defer) {
block->b_deferred_req =
rqstp->rq_chandle.defer(block->b_cache_req);
if (block->b_deferred_req != NULL)
status = nlm_drop_reply;
}
dprintk("lockd: nlmsvc_defer_lock_rqst block %p flags %d status %d\n",
block, block->b_flags, status);

return status;
}

/*
* Attempt to establish a lock, and if it can't be granted, block it
* if required.
Expand Down
10 changes: 10 additions & 0 deletions trunk/include/linux/lockd/lockd.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ struct nlm_file {
* couldn't be granted because of a conflicting lock).
*/
#define NLM_NEVER (~(unsigned long) 0)
/* timeout on non-blocking call: */
#define NLM_TIMEOUT (7 * HZ)

struct nlm_block {
struct kref b_count; /* Reference count */
struct list_head b_list; /* linked list of all blocks */
Expand All @@ -130,6 +133,13 @@ struct nlm_block {
unsigned int b_id; /* block id */
unsigned char b_granted; /* VFS granted lock */
struct nlm_file * b_file; /* file in question */
struct cache_req * b_cache_req; /* deferred request handling */
struct file_lock * b_fl; /* set for GETLK */
struct cache_deferred_req * b_deferred_req;
unsigned int b_flags; /* block flags */
#define B_QUEUED 1 /* lock queued */
#define B_GOT_CALLBACK 2 /* got lock or conflicting lock */
#define B_TIMED_OUT 4 /* filesystem too slow to respond */
};

/*
Expand Down

0 comments on commit fcc042b

Please sign in to comment.