diff options
author | Jeff Layton <jlayton@redhat.com> | 2008-07-15 14:06:48 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2008-07-15 14:26:52 -0400 |
commit | 8f920d5e29f86d3425a68e1c3bc264d1f6f55112 (patch) | |
tree | db3054c6d5f0a2a6b239b204171e119c69ab0217 /fs/lockd/svclock.c | |
parent | b0e92aae157cbf78ede7b7dd03967b49fcb2102e (diff) |
lockd: eliminate duplicate nlmsvc_lookup_host call from nlmsvc_testlock
nlmsvc_testlock calls nlmsvc_lookup_host to find a nlm_host struct. The
callers of this functions, however, call nlmsvc_retrieve_args or
nlm4svc_retrieve_args, which also return a nlm_host struct.
Change nlmsvc_testlock to take a host arg instead of calling
nlmsvc_lookup_host itself and change the callers to pass a pointer to
the nlm_host they've already found.
We take a reference to host in the place where nlmsvc_testlock()
previous did a new lookup, so the reference counting is unchanged from
before.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/lockd/svclock.c')
-rw-r--r-- | fs/lockd/svclock.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 81aca859bfde..f40afb3a0e69 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -460,8 +460,8 @@ out: | |||
460 | */ | 460 | */ |
461 | __be32 | 461 | __be32 |
462 | nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, | 462 | nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, |
463 | struct nlm_lock *lock, struct nlm_lock *conflock, | 463 | struct nlm_host *host, struct nlm_lock *lock, |
464 | struct nlm_cookie *cookie) | 464 | struct nlm_lock *conflock, struct nlm_cookie *cookie) |
465 | { | 465 | { |
466 | struct nlm_block *block = NULL; | 466 | struct nlm_block *block = NULL; |
467 | int error; | 467 | int error; |
@@ -479,16 +479,10 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, | |||
479 | 479 | ||
480 | if (block == NULL) { | 480 | if (block == NULL) { |
481 | struct file_lock *conf = kzalloc(sizeof(*conf), GFP_KERNEL); | 481 | struct file_lock *conf = kzalloc(sizeof(*conf), GFP_KERNEL); |
482 | struct nlm_host *host; | ||
483 | 482 | ||
484 | if (conf == NULL) | 483 | if (conf == NULL) |
485 | return nlm_granted; | 484 | return nlm_granted; |
486 | /* Create host handle for callback */ | 485 | nlm_get_host(host); |
487 | host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len); | ||
488 | if (host == NULL) { | ||
489 | kfree(conf); | ||
490 | return nlm_lck_denied_nolocks; | ||
491 | } | ||
492 | block = nlmsvc_create_block(rqstp, host, file, lock, cookie); | 486 | block = nlmsvc_create_block(rqstp, host, file, lock, cookie); |
493 | if (block == NULL) { | 487 | if (block == NULL) { |
494 | kfree(conf); | 488 | kfree(conf); |