]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
lockd: eliminate duplicate nlmsvc_lookup_host call from nlmsvc_lock
authorJeff Layton <jlayton@redhat.com>
Tue, 15 Jul 2008 18:26:17 +0000 (14:26 -0400)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Tue, 15 Jul 2008 18:53:33 +0000 (14:53 -0400)
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 <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
fs/lockd/svc4proc.c
fs/lockd/svclock.c
fs/lockd/svcproc.c
include/linux/lockd/lockd.h

index 8cfb9daa7c77f49988265e3e1d77ca56e37ff7ba..189b2ce01da6ae060a884cf3cd3f0bb93ceec946 100644 (file)
@@ -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;
index f40afb3a0e69124ce7eca769f56f05a18eb05e75..bcf73f6e8226e791e94a8104b2a72fcf9cc04103 100644 (file)
@@ -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;
 }
index e099f589b61b1eeae749f8ca1bf0d375b872c733..82dc9083ba67fea9c9fcfdb759bbcce71444c64f 100644 (file)
@@ -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;
index b27967034b53df810a1c7e5a786fd0fc669e870a..f81f9dd5f147e1303a1009e64ca7dad0652c0500 100644 (file)
@@ -200,7 +200,8 @@ typedef int   (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref);
  * Server-side lock handling
  */
 __be32           nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
-                                       struct nlm_lock *, int, struct nlm_cookie *);
+                             struct nlm_host *, struct nlm_lock *, int,
+                             struct nlm_cookie *);
 __be32           nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
 __be32           nlmsvc_testlock(struct svc_rqst *, struct nlm_file *,
                        struct nlm_host *, struct nlm_lock *,