nlm: minor nlm_lookup_file argument change
authorJ. Bruce Fields <bfields@redhat.com>
Mon, 23 Aug 2021 16:01:18 +0000 (12:01 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 23 Aug 2021 16:56:03 +0000 (12:56 -0400)
It'll come in handy to get the whole nlm_lock.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/lockd/svc4proc.c
fs/lockd/svcproc.c
fs/lockd/svcsubs.c
include/linux/lockd/lockd.h

index 4c10fb5..bc496bb 100644 (file)
@@ -40,7 +40,8 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
 
        /* Obtain file pointer. Not used by FREE_ALL call. */
        if (filp != NULL) {
-               if ((error = nlm_lookup_file(rqstp, &file, &lock->fh)) != 0)
+               error = nlm_lookup_file(rqstp, &file, lock);
+               if (error)
                        goto no_locks;
                *filp = file;
 
index 4ae4b63..f4e5e0e 100644 (file)
@@ -69,7 +69,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
 
        /* Obtain file pointer. Not used by FREE_ALL call. */
        if (filp != NULL) {
-               error = cast_status(nlm_lookup_file(rqstp, &file, &lock->fh));
+               error = cast_status(nlm_lookup_file(rqstp, &file, lock));
                if (error != 0)
                        goto no_locks;
                *filp = file;
index 028fc15..2d62633 100644 (file)
@@ -82,31 +82,31 @@ static inline unsigned int file_hash(struct nfs_fh *f)
  */
 __be32
 nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
-                                       struct nfs_fh *f)
+                                       struct nlm_lock *lock)
 {
        struct nlm_file *file;
        unsigned int    hash;
        __be32          nfserr;
 
-       nlm_debug_print_fh("nlm_lookup_file", f);
+       nlm_debug_print_fh("nlm_lookup_file", &lock->fh);
 
-       hash = file_hash(f);
+       hash = file_hash(&lock->fh);
 
        /* Lock file table */
        mutex_lock(&nlm_file_mutex);
 
        hlist_for_each_entry(file, &nlm_files[hash], f_list)
-               if (!nfs_compare_fh(&file->f_handle, f))
+               if (!nfs_compare_fh(&file->f_handle, &lock->fh))
                        goto found;
 
-       nlm_debug_print_fh("creating file for", f);
+       nlm_debug_print_fh("creating file for", &lock->fh);
 
        nfserr = nlm_lck_denied_nolocks;
        file = kzalloc(sizeof(*file), GFP_KERNEL);
        if (!file)
                goto out_unlock;
 
-       memcpy(&file->f_handle, f, sizeof(struct nfs_fh));
+       memcpy(&file->f_handle, &lock->fh, sizeof(struct nfs_fh));
        mutex_init(&file->f_mutex);
        INIT_HLIST_NODE(&file->f_list);
        INIT_LIST_HEAD(&file->f_blocks);
@@ -117,7 +117,8 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
         * We have to make sure we have the right credential to open
         * the file.
         */
-       if ((nfserr = nlmsvc_ops->fopen(rqstp, f, &file->f_file)) != 0) {
+       nfserr = nlmsvc_ops->fopen(rqstp, &lock->fh, &file->f_file);
+       if (nfserr) {
                dprintk("lockd: open failed (error %d)\n", nfserr);
                goto out_free;
        }
index 666f5f3..81b71ad 100644 (file)
@@ -286,7 +286,7 @@ void                  nlmsvc_locks_init_private(struct file_lock *, struct nlm_host *, pid_t);
  * File handling for the server personality
  */
 __be32           nlm_lookup_file(struct svc_rqst *, struct nlm_file **,
-                                       struct nfs_fh *);
+                                       struct nlm_lock *);
 void             nlm_release_file(struct nlm_file *);
 void             nlmsvc_release_lockowner(struct nlm_lock *);
 void             nlmsvc_mark_resources(struct net *);