]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
lockd: Add LOCKD_SHARE_SVID constant for DOS sharing mode
authorChuck Lever <chuck.lever@oracle.com>
Tue, 17 Feb 2026 22:07:19 +0000 (17:07 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 30 Mar 2026 01:25:09 +0000 (21:25 -0400)
Replace the magic value ~(u32)0 with a named constant. This value
is used as a synthetic svid when looking up lockowners for DOS
share operations, which have no real process ID associated with
them.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/lockd/share.h
fs/lockd/svc4proc.c
fs/lockd/xdr.c

index a2867e30c593ffcc3be877ec7a4fbc996c9a426b..20ea8ee4916826a87969a084b0e34d889eab79da 100644 (file)
@@ -8,6 +8,9 @@
 #ifndef _LOCKD_SHARE_H
 #define _LOCKD_SHARE_H
 
+/* Synthetic svid for lockowner lookup during share operations */
+#define LOCKD_SHARE_SVID       (~(u32)0)
+
 /*
  * DOS share for a specific file
  */
index ca0409ea6b2dc86f15be5b501bb4652a184d9ff3..ce340ea0d304d99f9e3fdd26bf60ae8e88b47554 100644 (file)
@@ -985,7 +985,7 @@ static __be32 nlm4svc_proc_share(struct svc_rqst *rqstp)
        struct nlm4_lock xdr_lock = {
                .fh             = argp->xdrgen.share.fh,
                .oh             = argp->xdrgen.share.oh,
-               .svid           = ~(u32)0,
+               .svid           = LOCKD_SHARE_SVID,
        };
 
        resp->xdrgen.cookie = argp->xdrgen.cookie;
@@ -1051,7 +1051,7 @@ static __be32 nlm4svc_proc_unshare(struct svc_rqst *rqstp)
        struct nlm4_lock xdr_lock = {
                .fh             = argp->xdrgen.share.fh,
                .oh             = argp->xdrgen.share.oh,
-               .svid           = ~(u32)0,
+               .svid           = LOCKD_SHARE_SVID,
        };
        struct nlm_host *host = NULL;
        struct nlm_file *file = NULL;
index 5aac49d1875af58c8bdb2390f0a1dfba9abf49fa..dfca8b8dab73319cd7a65e134bbde84b05c0ea62 100644 (file)
@@ -19,6 +19,7 @@
 #include <uapi/linux/nfs2.h>
 
 #include "lockd.h"
+#include "share.h"
 #include "svcxdr.h"
 
 static inline loff_t
@@ -274,7 +275,7 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 
        memset(lock, 0, sizeof(*lock));
        locks_init_lock(&lock->fl);
-       lock->svid = ~(u32)0;
+       lock->svid = LOCKD_SHARE_SVID;
 
        if (!svcxdr_decode_cookie(xdr, &argp->cookie))
                return false;