]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
lockd: Relocate and rename nlm_drop_reply
authorChuck Lever <chuck.lever@oracle.com>
Wed, 28 Jan 2026 15:19:23 +0000 (10:19 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 30 Mar 2026 01:25:09 +0000 (21:25 -0400)
The nlm_drop_reply status code is internal to the kernel's lockd
implementation and must never appear on the wire. Its previous
location in xdr.h grouped it with legitimate NLM protocol status
codes, obscuring this critical distinction.

Relocate the definition to lockd.h with a comment block for internal
status codes, and rename to nlm__int__drop_reply to make its
internal-only nature explicit. This prepares for adding additional
internal status codes in subsequent patches.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/lockd/svc4proc.c
fs/lockd/svclock.c
fs/lockd/svcproc.c
fs/nfsd/lockd.c
include/linux/lockd/lockd.h
include/linux/lockd/xdr.h

index 4b6f18d977343debae21e05dd353b7cbd2de887f..9c756d07223afd1a9b03fd9bef3bf6400a4b66f4 100644 (file)
@@ -104,12 +104,13 @@ __nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
 
        /* Obtain client and file */
        if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
-               return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
+               return resp->status == nlm__int__drop_reply ?
+                       rpc_drop_reply : rpc_success;
 
        /* Now check for conflicting locks */
        resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock,
                                       &resp->lock);
-       if (resp->status == nlm_drop_reply)
+       if (resp->status == nlm__int__drop_reply)
                rc = rpc_drop_reply;
        else
                dprintk("lockd: TEST4        status %d\n", ntohl(resp->status));
@@ -140,13 +141,14 @@ __nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
 
        /* Obtain client and file */
        if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
-               return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
+               return resp->status == nlm__int__drop_reply ?
+                       rpc_drop_reply : rpc_success;
 
        /* Now try to lock the file */
        resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock,
                                        argp->block, &argp->cookie,
                                        argp->reclaim);
-       if (resp->status == nlm_drop_reply)
+       if (resp->status == nlm__int__drop_reply)
                rc = rpc_drop_reply;
        else
                dprintk("lockd: LOCK         status %d\n", ntohl(resp->status));
@@ -182,7 +184,8 @@ __nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
 
        /* Obtain client and file */
        if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
-               return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
+               return resp->status == nlm__int__drop_reply ?
+                       rpc_drop_reply : rpc_success;
 
        /* Try to cancel request. */
        resp->status = nlmsvc_cancel_blocked(SVC_NET(rqstp), file, &argp->lock);
@@ -222,7 +225,8 @@ __nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
 
        /* Obtain client and file */
        if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
-               return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
+               return resp->status == nlm__int__drop_reply ?
+                       rpc_drop_reply : rpc_success;
 
        /* Now try to remove the lock */
        resp->status = nlmsvc_unlock(SVC_NET(rqstp), file, &argp->lock);
@@ -369,7 +373,8 @@ nlm4svc_proc_share(struct svc_rqst *rqstp)
 
        /* Obtain client and file */
        if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
-               return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
+               return resp->status == nlm__int__drop_reply ?
+                       rpc_drop_reply : rpc_success;
 
        /* Now try to create the share */
        resp->status = nlmsvc_share_file(host, file, argp);
@@ -404,7 +409,8 @@ nlm4svc_proc_unshare(struct svc_rqst *rqstp)
 
        /* Obtain client and file */
        if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
-               return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
+               return resp->status == nlm__int__drop_reply ?
+                       rpc_drop_reply : rpc_success;
 
        /* Now try to lock the file */
        resp->status = nlmsvc_unshare_file(host, file, argp);
index 255a847ca0b6b9f7ab5a99c3aaa6856044ac0535..d86b02153c7c36d1b757802e28edb4b8edc4f33e 100644 (file)
@@ -463,7 +463,7 @@ nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block)
                block->b_deferred_req =
                        rqstp->rq_chandle.defer(block->b_cache_req);
                if (block->b_deferred_req != NULL)
-                       status = nlm_drop_reply;
+                       status = nlm__int__drop_reply;
        }
        dprintk("lockd: nlmsvc_defer_lock_rqst block %p flags %d status %d\n",
                block, block->b_flags, ntohl(status));
@@ -531,7 +531,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
                        ret = nlm_lck_denied;
                        goto out;
                }
-               ret = nlm_drop_reply;
+               ret = nlm__int__drop_reply;
                goto out;
        }
 
index 95c6bf7ab757473e7a6b9943e8aee05569c02633..2a2e48a9bd12ba675f38fa66522b1f4d6322dc0e 100644 (file)
@@ -25,7 +25,7 @@ static inline __be32 cast_status(__be32 status)
        case nlm_lck_denied_nolocks:
        case nlm_lck_blocked:
        case nlm_lck_denied_grace_period:
-       case nlm_drop_reply:
+       case nlm__int__drop_reply:
                break;
        case nlm4_deadlock:
                status = nlm_lck_denied;
@@ -122,12 +122,13 @@ __nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
 
        /* Obtain client and file */
        if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
-               return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
+               return resp->status == nlm__int__drop_reply ?
+                       rpc_drop_reply : rpc_success;
 
        /* Now check for conflicting locks */
        resp->status = cast_status(nlmsvc_testlock(rqstp, file, host,
                                                   &argp->lock, &resp->lock));
-       if (resp->status == nlm_drop_reply)
+       if (resp->status == nlm__int__drop_reply)
                rc = rpc_drop_reply;
        else
                dprintk("lockd: TEST          status %d vers %d\n",
@@ -159,13 +160,14 @@ __nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
 
        /* Obtain client and file */
        if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
-               return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
+               return resp->status == nlm__int__drop_reply ?
+                       rpc_drop_reply : rpc_success;
 
        /* Now try to lock the file */
        resp->status = cast_status(nlmsvc_lock(rqstp, file, host, &argp->lock,
                                               argp->block, &argp->cookie,
                                               argp->reclaim));
-       if (resp->status == nlm_drop_reply)
+       if (resp->status == nlm__int__drop_reply)
                rc = rpc_drop_reply;
        else
                dprintk("lockd: LOCK         status %d\n", ntohl(resp->status));
@@ -202,7 +204,8 @@ __nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
 
        /* Obtain client and file */
        if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
-               return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
+               return resp->status == nlm__int__drop_reply ?
+                       rpc_drop_reply : rpc_success;
 
        /* Try to cancel request. */
        resp->status = cast_status(nlmsvc_cancel_blocked(net, file, &argp->lock));
@@ -243,7 +246,8 @@ __nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
 
        /* Obtain client and file */
        if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
-               return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
+               return resp->status == nlm__int__drop_reply ?
+                       rpc_drop_reply : rpc_success;
 
        /* Now try to remove the lock */
        resp->status = cast_status(nlmsvc_unlock(net, file, &argp->lock));
@@ -400,7 +404,8 @@ nlmsvc_proc_share(struct svc_rqst *rqstp)
 
        /* Obtain client and file */
        if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
-               return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
+               return resp->status == nlm__int__drop_reply ?
+                       rpc_drop_reply : rpc_success;
 
        /* Now try to create the share */
        resp->status = cast_status(nlmsvc_share_file(host, file, argp));
@@ -435,7 +440,8 @@ nlmsvc_proc_unshare(struct svc_rqst *rqstp)
 
        /* Obtain client and file */
        if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
-               return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
+               return resp->status == nlm__int__drop_reply ?
+                       rpc_drop_reply : rpc_success;
 
        /* Now try to unshare the file */
        resp->status = cast_status(nlmsvc_unshare_file(host, file, argp));
index c774ce9aa29652a8c2da79deaa2e2c09eb33ebb9..8c230ccd6645b81ecbc3e888d45fc07097ec4f67 100644 (file)
@@ -71,7 +71,7 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp,
                 * to callback when the delegation is returned but might
                 * not have a proper lock request to block on.
                 */
-               return nlm_drop_reply;
+               return nlm__int__drop_reply;
        case nfserr_stale:
                return nlm_stale_fh;
        default:
index 330e38776bb20d09c20697fc38a96c161ad0313a..fdefec39553f044aceff19e1ae4f1ee871c14cb6 100644 (file)
  */
 #define LOCKD_DFLT_TIMEO       10
 
+/*
+ * Internal-use status codes, not to be placed on the wire.
+ * Version handlers translate these to appropriate wire values.
+ */
+#define nlm__int__drop_reply   cpu_to_be32(30000)
+
 /*
  * Lockd host handle (used both by the client and server personality).
  */
index 17d53165d9f24102a02feafa64db4b15f4d88e59..292e4e38d17d4773a2e0b46917cbc4a6cf69367a 100644 (file)
@@ -33,8 +33,6 @@ struct svc_rqst;
 #define        nlm_lck_blocked         cpu_to_be32(NLM_LCK_BLOCKED)
 #define        nlm_lck_denied_grace_period     cpu_to_be32(NLM_LCK_DENIED_GRACE_PERIOD)
 
-#define nlm_drop_reply         cpu_to_be32(30000)
-
 /* Lock info passed via NLM */
 struct nlm_lock {
        char *                  caller;