diff options
author | Andy Adamson <andros@citi.umich.edu> | 2006-03-20 13:44:24 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:24 -0500 |
commit | 15dadef9460ad8d3b1d5ede1c1697dc79af44a72 (patch) | |
tree | e95ff41246a7fb25ad523e1868166d2f2d9ef2e9 /fs/lockd | |
parent | 1e7cb3dc12dbbac690d78c84f9c7cb11132ed121 (diff) |
lockd: clean up nlmsvc_lock
Slightly more consistent dprintk error reporting, consolidate some up()'s.
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 | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index a525a141dd3b..42dd105456c5 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -300,6 +300,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, | |||
300 | struct file_lock *conflock; | 300 | struct file_lock *conflock; |
301 | struct nlm_block *block; | 301 | struct nlm_block *block; |
302 | int error; | 302 | int error; |
303 | u32 ret; | ||
303 | 304 | ||
304 | dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", | 305 | dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", |
305 | file->f_file->f_dentry->d_inode->i_sb->s_id, | 306 | file->f_file->f_dentry->d_inode->i_sb->s_id, |
@@ -329,24 +330,28 @@ again: | |||
329 | dprintk("lockd: posix_lock_file returned %d\n", -error); | 330 | dprintk("lockd: posix_lock_file returned %d\n", -error); |
330 | switch(-error) { | 331 | switch(-error) { |
331 | case 0: | 332 | case 0: |
332 | return nlm_granted; | 333 | ret = nlm_granted; |
334 | goto out; | ||
333 | case EDEADLK: | 335 | case EDEADLK: |
334 | return nlm_deadlock; | 336 | ret = nlm_deadlock; |
337 | goto out; | ||
335 | case EAGAIN: | 338 | case EAGAIN: |
336 | return nlm_lck_denied; | 339 | ret = nlm_lck_denied; |
340 | goto out; | ||
337 | default: /* includes ENOLCK */ | 341 | default: /* includes ENOLCK */ |
338 | return nlm_lck_denied_nolocks; | 342 | ret = nlm_lck_denied_nolocks; |
343 | goto out; | ||
339 | } | 344 | } |
340 | } | 345 | } |
341 | 346 | ||
342 | if (!wait) { | 347 | if (!wait) { |
343 | up(&file->f_sema); | 348 | ret = nlm_lck_denied; |
344 | return nlm_lck_denied; | 349 | goto out_unlock; |
345 | } | 350 | } |
346 | 351 | ||
347 | if (posix_locks_deadlock(&lock->fl, conflock)) { | 352 | if (posix_locks_deadlock(&lock->fl, conflock)) { |
348 | up(&file->f_sema); | 353 | ret = nlm_deadlock; |
349 | return nlm_deadlock; | 354 | goto out_unlock; |
350 | } | 355 | } |
351 | 356 | ||
352 | /* If we don't have a block, create and initialize it. Then | 357 | /* If we don't have a block, create and initialize it. Then |
@@ -371,8 +376,12 @@ again: | |||
371 | posix_block_lock(conflock, &block->b_call.a_args.lock.fl); | 376 | posix_block_lock(conflock, &block->b_call.a_args.lock.fl); |
372 | } | 377 | } |
373 | 378 | ||
379 | ret = nlm_lck_blocked; | ||
380 | out_unlock: | ||
374 | up(&file->f_sema); | 381 | up(&file->f_sema); |
375 | return nlm_lck_blocked; | 382 | out: |
383 | dprintk("lockd: nlmsvc_lock returned %u\n", ret); | ||
384 | return ret; | ||
376 | } | 385 | } |
377 | 386 | ||
378 | /* | 387 | /* |
@@ -535,8 +544,7 @@ nlmsvc_grant_blocked(struct nlm_block *block) | |||
535 | dprintk("lockd: lock still blocked\n"); | 544 | dprintk("lockd: lock still blocked\n"); |
536 | nlmsvc_insert_block(block, NLM_NEVER); | 545 | nlmsvc_insert_block(block, NLM_NEVER); |
537 | posix_block_lock(conflock, &lock->fl); | 546 | posix_block_lock(conflock, &lock->fl); |
538 | up(&file->f_sema); | 547 | goto out_unlock; |
539 | return; | ||
540 | } | 548 | } |
541 | 549 | ||
542 | /* Alright, no conflicting lock. Now lock it for real. If the | 550 | /* Alright, no conflicting lock. Now lock it for real. If the |
@@ -547,8 +555,7 @@ nlmsvc_grant_blocked(struct nlm_block *block) | |||
547 | printk(KERN_WARNING "lockd: unexpected error %d in %s!\n", | 555 | printk(KERN_WARNING "lockd: unexpected error %d in %s!\n", |
548 | -error, __FUNCTION__); | 556 | -error, __FUNCTION__); |
549 | nlmsvc_insert_block(block, 10 * HZ); | 557 | nlmsvc_insert_block(block, 10 * HZ); |
550 | up(&file->f_sema); | 558 | goto out_unlock; |
551 | return; | ||
552 | } | 559 | } |
553 | 560 | ||
554 | callback: | 561 | callback: |
@@ -565,6 +572,7 @@ callback: | |||
565 | if (nlmsvc_async_call(&block->b_call, NLMPROC_GRANTED_MSG, | 572 | if (nlmsvc_async_call(&block->b_call, NLMPROC_GRANTED_MSG, |
566 | &nlmsvc_grant_ops) < 0) | 573 | &nlmsvc_grant_ops) < 0) |
567 | nlm_release_host(block->b_call.a_host); | 574 | nlm_release_host(block->b_call.a_host); |
575 | out_unlock: | ||
568 | up(&file->f_sema); | 576 | up(&file->f_sema); |
569 | } | 577 | } |
570 | 578 | ||