mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
lockd: eliminate duplicate nlmsvc_lookup_host call from nlmsvc_lock
nlmsvc_lock calls nlmsvc_lookup_host to find a nlm_host struct. The callers of this function, however, call nlmsvc_retrieve_args or nlm4svc_retrieve_args, which also return a nlm_host struct. Change nlmsvc_lock 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. Since nlmsvc_testlock() now just uses the caller's reference, we no longer need to get or release it. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
This commit is contained in:
parent
8f920d5e29
commit
6cde4de807
4 changed files with 6 additions and 11 deletions
|
|
@ -145,7 +145,7 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
|
|||
#endif
|
||||
|
||||
/* Now try to lock the file */
|
||||
resp->status = nlmsvc_lock(rqstp, file, &argp->lock,
|
||||
resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock,
|
||||
argp->block, &argp->cookie);
|
||||
if (resp->status == nlm_drop_reply)
|
||||
rc = rpc_drop_reply;
|
||||
|
|
|
|||
|
|
@ -358,10 +358,10 @@ nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block)
|
|||
*/
|
||||
__be32
|
||||
nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
|
||||
struct nlm_lock *lock, int wait, struct nlm_cookie *cookie)
|
||||
struct nlm_host *host, struct nlm_lock *lock, int wait,
|
||||
struct nlm_cookie *cookie)
|
||||
{
|
||||
struct nlm_block *block = NULL;
|
||||
struct nlm_host *host;
|
||||
int error;
|
||||
__be32 ret;
|
||||
|
||||
|
|
@ -373,11 +373,6 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
|
|||
(long long)lock->fl.fl_end,
|
||||
wait);
|
||||
|
||||
/* Create host handle for callback */
|
||||
host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len);
|
||||
if (host == NULL)
|
||||
return nlm_lck_denied_nolocks;
|
||||
|
||||
/* Lock file against concurrent access */
|
||||
mutex_lock(&file->f_mutex);
|
||||
/* Get existing block (in case client is busy-waiting)
|
||||
|
|
@ -450,7 +445,6 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
|
|||
out:
|
||||
mutex_unlock(&file->f_mutex);
|
||||
nlmsvc_release_block(block);
|
||||
nlm_release_host(host);
|
||||
dprintk("lockd: nlmsvc_lock returned %u\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
|
|||
#endif
|
||||
|
||||
/* Now try to lock the file */
|
||||
resp->status = cast_status(nlmsvc_lock(rqstp, file, &argp->lock,
|
||||
resp->status = cast_status(nlmsvc_lock(rqstp, file, host, &argp->lock,
|
||||
argp->block, &argp->cookie));
|
||||
if (resp->status == nlm_drop_reply)
|
||||
rc = rpc_drop_reply;
|
||||
|
|
|
|||
Loading…
Reference in a new issue