struct nlm_args *argp = rqstp->rq_argp;
        struct nlm_host *host;
        struct nlm_file *file;
+       struct nlm_lockowner *test_owner;
        __be32 rc = rpc_success;
 
        dprintk("lockd: TEST4        called\n");
        if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
                return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
 
+       test_owner = argp->lock.fl.fl_owner;
        /* Now check for conflicting locks */
        resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie);
        if (resp->status == nlm_drop_reply)
        else
                dprintk("lockd: TEST4        status %d\n", ntohl(resp->status));
 
-       nlmsvc_release_lockowner(&argp->lock);
+       nlmsvc_put_lockowner(test_owner);
        nlmsvc_release_host(host);
        nlm_release_file(file);
        return rc;
 
        return lockowner;
 }
 
-static void nlmsvc_put_lockowner(struct nlm_lockowner *lockowner)
+void nlmsvc_put_lockowner(struct nlm_lockowner *lockowner)
 {
        if (!refcount_dec_and_lock(&lockowner->count, &lockowner->host->h_lock))
                return;
        int                     error;
        int                     mode;
        __be32                  ret;
-       struct nlm_lockowner    *test_owner;
 
        dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n",
                                nlmsvc_file_inode(file)->i_sb->s_id,
                goto out;
        }
 
-       /* If there's a conflicting lock, remember to clean up the test lock */
-       test_owner = (struct nlm_lockowner *)lock->fl.fl_owner;
-
        mode = lock_to_openmode(&lock->fl);
        error = vfs_test_lock(file->f_file[mode], &lock->fl);
        if (error) {
        conflock->fl.fl_end = lock->fl.fl_end;
        locks_release_private(&lock->fl);
 
-       /* Clean up the test lock */
-       lock->fl.fl_owner = NULL;
-       nlmsvc_put_lockowner(test_owner);
-
        ret = nlm_lck_denied;
 out:
        return ret;
 
        struct nlm_args *argp = rqstp->rq_argp;
        struct nlm_host *host;
        struct nlm_file *file;
+       struct nlm_lockowner *test_owner;
        __be32 rc = rpc_success;
 
        dprintk("lockd: TEST          called\n");
        if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
                return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
 
+       test_owner = argp->lock.fl.fl_owner;
+
        /* Now check for conflicting locks */
        resp->status = cast_status(nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie));
        if (resp->status == nlm_drop_reply)
                dprintk("lockd: TEST          status %d vers %d\n",
                        ntohl(resp->status), rqstp->rq_vers);
 
-       nlmsvc_release_lockowner(&argp->lock);
+       nlmsvc_put_lockowner(test_owner);
        nlmsvc_release_host(host);
        nlm_release_file(file);
        return rc;
 
 __be32           nlm_lookup_file(struct svc_rqst *, struct nlm_file **,
                                        struct nlm_lock *);
 void             nlm_release_file(struct nlm_file *);
+void             nlmsvc_put_lockowner(struct nlm_lockowner *);
 void             nlmsvc_release_lockowner(struct nlm_lock *);
 void             nlmsvc_mark_resources(struct net *);
 void             nlmsvc_free_host_resources(struct nlm_host *);