diff options
author | Andy Adamson <andros@citi.umich.edu> | 2006-03-20 13:44:25 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:25 -0500 |
commit | 5de0e5024a4e21251fd80dbfdb83316ce97086bc (patch) | |
tree | fa34eeee2aa007fb49b34c45e55aafc8b67c6e37 /fs/lockd | |
parent | 15dadef9460ad8d3b1d5ede1c1697dc79af44a72 (diff) |
lockd: simplify nlmsvc_grant_blocked
Reorganize nlmsvc_grant_blocked() to make full use of posix_lock_file(). Note
that there's no need for separate calls to posix_test_lock(),
posix_locks_deadlock(), or posix_block_lock().
Signed-off-by: Andy Adamson <andros@citi.umich.edu>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/lockd')
-rw-r--r-- | fs/lockd/svclock.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 42dd105456c5..58bbfede94ec 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -519,7 +519,6 @@ nlmsvc_grant_blocked(struct nlm_block *block) | |||
519 | { | 519 | { |
520 | struct nlm_file *file = block->b_file; | 520 | struct nlm_file *file = block->b_file; |
521 | struct nlm_lock *lock = &block->b_call.a_args.lock; | 521 | struct nlm_lock *lock = &block->b_call.a_args.lock; |
522 | struct file_lock *conflock; | ||
523 | int error; | 522 | int error; |
524 | 523 | ||
525 | dprintk("lockd: grant blocked lock %p\n", block); | 524 | dprintk("lockd: grant blocked lock %p\n", block); |
@@ -539,19 +538,15 @@ nlmsvc_grant_blocked(struct nlm_block *block) | |||
539 | } | 538 | } |
540 | 539 | ||
541 | /* Try the lock operation again */ | 540 | /* Try the lock operation again */ |
542 | if ((conflock = posix_test_lock(file->f_file, &lock->fl)) != NULL) { | 541 | error = posix_lock_file(file->f_file, &lock->fl); |
543 | /* Bummer, we blocked again */ | 542 | switch (error) { |
543 | case 0: | ||
544 | break; | ||
545 | case -EAGAIN: | ||
544 | dprintk("lockd: lock still blocked\n"); | 546 | dprintk("lockd: lock still blocked\n"); |
545 | nlmsvc_insert_block(block, NLM_NEVER); | 547 | nlmsvc_insert_block(block, NLM_NEVER); |
546 | posix_block_lock(conflock, &lock->fl); | ||
547 | goto out_unlock; | 548 | goto out_unlock; |
548 | } | 549 | default: |
549 | |||
550 | /* Alright, no conflicting lock. Now lock it for real. If the | ||
551 | * following yields an error, this is most probably due to low | ||
552 | * memory. Retry the lock in a few seconds. | ||
553 | */ | ||
554 | if ((error = posix_lock_file(file->f_file, &lock->fl)) < 0) { | ||
555 | printk(KERN_WARNING "lockd: unexpected error %d in %s!\n", | 550 | printk(KERN_WARNING "lockd: unexpected error %d in %s!\n", |
556 | -error, __FUNCTION__); | 551 | -error, __FUNCTION__); |
557 | nlmsvc_insert_block(block, 10 * HZ); | 552 | nlmsvc_insert_block(block, 10 * HZ); |