aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@fieldses.org>2006-01-03 03:55:42 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-06 14:58:53 -0500
commitf232142cc21127c829559923eb405d1bcb2e2278 (patch)
tree4ac11e21c008a26b6e9e5ad3ac4db8b2920534a9
parentfb459f45f7c7689714023d41b3dca999bb90a5d3 (diff)
NLM: Clean up nlmsvc_grant_reply locking
Slightly simpler logic here makes it more trivial to verify that the up's and down's are balanced here. Break out an assignment from a conditional while we're at it. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/lockd/svclock.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 87d09a0d8f64..e42f0cc6c450 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -637,11 +637,12 @@ nlmsvc_grant_reply(struct svc_rqst *rqstp, struct nlm_cookie *cookie, u32 status
637 637
638 file->f_count++; 638 file->f_count++;
639 down(&file->f_sema); 639 down(&file->f_sema);
640 if ((block = nlmsvc_find_block(cookie,&rqstp->rq_addr)) != NULL) { 640 block = nlmsvc_find_block(cookie, &rqstp->rq_addr);
641 if (block) {
641 if (status == NLM_LCK_DENIED_GRACE_PERIOD) { 642 if (status == NLM_LCK_DENIED_GRACE_PERIOD) {
642 /* Try again in a couple of seconds */ 643 /* Try again in a couple of seconds */
643 nlmsvc_insert_block(block, 10 * HZ); 644 nlmsvc_insert_block(block, 10 * HZ);
644 block = NULL; 645 up(&file->f_sema);
645 } else { 646 } else {
646 /* Lock is now held by client, or has been rejected. 647 /* Lock is now held by client, or has been rejected.
647 * In both cases, the block should be removed. */ 648 * In both cases, the block should be removed. */
@@ -652,8 +653,6 @@ nlmsvc_grant_reply(struct svc_rqst *rqstp, struct nlm_cookie *cookie, u32 status
652 nlmsvc_delete_block(block, 1); 653 nlmsvc_delete_block(block, 1);
653 } 654 }
654 } 655 }
655 if (!block)
656 up(&file->f_sema);
657 nlm_release_file(file); 656 nlm_release_file(file);
658} 657}
659 658