lockd: Add LOCKD_SHARE_SVID constant for DOS sharing mode

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>
This commit is contained in:
Chuck Lever 2026-02-17 17:07:19 -05:00
parent b201ce7af2
commit 515788fa98
3 changed files with 7 additions and 3 deletions

View 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
*/

View 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;

View 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;