* [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen
@ 2026-05-12 18:13 Chuck Lever
2026-05-12 18:13 ` [PATCH 01/38] lockd: Stop warning on nlm__int__drop_reply in !V4 cast_status Chuck Lever
` (38 more replies)
0 siblings, 39 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
This series finishes the xdrgen migration of lockd's server-side
stack. The companion NLMv4 work landed earlier; here the
remaining hand-written XDR in fs/lockd/xdr.c is retired in
favour of code generated from a new
Documentation/sunrpc/xdr/nlm3.x.
XDR helpers now do wire-format conversion only. NLMv3's
32-bit range limit on TEST conflict-holder byte ranges is
clamped at the proc function rather than inside loff_t_to_s32()
in the encoder. The HP-UX zero-length cookie rewrite that
svcxdr_decode_cookie() has carried since the original kernel
import is dropped on the server side; the generated decoder
reproduces the cookie verbatim, and neither NLM_TEST reply
matching nor CANCEL_MSG depends on the substitution.
A wrapper struct bridges each generated argument type with
lockd's legacy lockd_lock/lockd_cookie/lockd_res internals.
Each handler reaches xdrgen-decoded fields through argp->xdrgen
and the legacy layout through a wrapper member that the handler
populates explicitly, typically in nlm3svc_lookup_file(). The
core lockd helpers and the async callback path operate on the
legacy types unchanged, which is what keeps the conversion
incremental.
.pc_argzero is cleared for every converted procedure: the
generated decoders fill the substructure they own, so the
dispatch layer's zero-memset is no longer needed. The
trade-off is that any wrapper field a handler reads must be
initialized explicitly. lock members are populated by
nlm3svc_lookup_file(), or on the GRANTED path by the new
nlm_lock_to_lockd_lock() helper.
Five NLMv4 fixes at the head of the series and three cleanup
patches at the tail bracket the conversion. The six lockd_
struct renames between them are split out so that each
conversion patch reads as a single concern.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
Chuck Lever (38):
lockd: Stop warning on nlm__int__drop_reply in !V4 cast_status
lockd: Correct kernel-doc status descriptions for NLMv4 GRANTED
lockd: Drop locks_init_lock() from nlm4_lock_to_lockd_lock()
lockd: Translate nlm__int__deadlock in __nlm4svc_proc_lock_msg()
lockd: Do not monitor when looking up the LOCK_MSG callback host
Documentation: Add the RPC language description of NLM version 3
lockd: Rename struct nlm_cookie to lockd_cookie
lockd: Rename struct nlm_lock to lockd_lock
lockd: Rename struct nlm_args to lockd_args
lockd: Rename struct nlm_res to lockd_res
lockd: Rename struct nlm_reboot to lockd_reboot
lockd: Rename struct nlm_share to lockd_share
lockd: Use xdrgen XDR functions for the NLMv3 NULL procedure
lockd: Use xdrgen XDR functions for the NLMv3 TEST procedure
lockd: Use xdrgen XDR functions for the NLMv3 LOCK procedure
lockd: Use xdrgen XDR functions for the NLMv3 CANCEL procedure
lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK procedure
lockd: Use xdrgen XDR functions for the NLMv3 GRANTED procedure
lockd: Refactor nlmsvc_callback()
lockd: Use xdrgen XDR functions for the NLMv3 TEST_MSG procedure
lockd: Use xdrgen XDR functions for the NLMv3 LOCK_MSG procedure
lockd: Use xdrgen XDR functions for the NLMv3 CANCEL_MSG procedure
lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK_MSG procedure
lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_MSG procedure
lockd: Use xdrgen XDR functions for the NLMv3 TEST_RES procedure
lockd: Use xdrgen XDR functions for the NLMv3 LOCK_RES procedure
lockd: Use xdrgen XDR functions for the NLMv3 CANCEL_RES procedure
lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK_RES procedure
lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_RES procedure
lockd: Use xdrgen XDR functions for the NLMv3 SM_NOTIFY procedure
lockd: Convert NLMv3 server-side undefined procedures to xdrgen
lockd: Use xdrgen XDR functions for the NLMv3 SHARE procedure
lockd: Use xdrgen XDR functions for the NLMv3 UNSHARE procedure
lockd: Use xdrgen XDR functions for the NLMv3 NM_LOCK procedure
lockd: Use xdrgen XDR functions for the NLMv3 FREE_ALL procedure
lockd: Remove C macros that are no longer used
lockd: Remove dead code from fs/lockd/xdr.c
lockd: Unify cast_status
Documentation/sunrpc/xdr/nlm3.x | 168 ++++
fs/lockd/Makefile | 19 +-
fs/lockd/clnt4xdr.c | 42 +-
fs/lockd/clntlock.c | 2 +-
fs/lockd/clntproc.c | 14 +-
fs/lockd/clntxdr.c | 44 +-
fs/lockd/host.c | 4 +-
fs/lockd/lockd.h | 57 +-
fs/lockd/mon.c | 2 +-
fs/lockd/nlm3xdr_gen.c | 714 ++++++++++++++
fs/lockd/nlm3xdr_gen.h | 32 +
fs/lockd/share.h | 4 +-
fs/lockd/svc4proc.c | 69 +-
fs/lockd/svclock.c | 38 +-
fs/lockd/svcproc.c | 1844 ++++++++++++++++++++++++------------
fs/lockd/svcshare.c | 8 +-
fs/lockd/svcsubs.c | 2 +-
fs/lockd/svcxdr.h | 142 ---
fs/lockd/trace.h | 16 +-
fs/lockd/xdr.c | 354 -------
fs/lockd/xdr.h | 39 +-
include/linux/sunrpc/xdrgen/nlm3.h | 210 ++++
22 files changed, 2538 insertions(+), 1286 deletions(-)
---
base-commit: b26490baad0b7318d763b5ad6e5ca2addb20b314
change-id: 20260427-nlm4-xdrgen-35bf1c6869b8
Best regards,
--
Chuck Lever <chuck.lever@oracle.com>
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 01/38] lockd: Stop warning on nlm__int__drop_reply in !V4 cast_status
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 02/38] lockd: Correct kernel-doc status descriptions for NLMv4 GRANTED Chuck Lever
` (37 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
cast_status folds internal lock-daemon sentinels into NLMv1/v3
wire status codes. The !CONFIG_LOCKD_V4 variant warns when an
unrecognized status falls into the internal-sentinel range,
gated by be32_to_cpu(status) >= 30000.
nlm__int__drop_reply is defined as cpu_to_be32(30000), so it
sits at the lower edge of that range and trips pr_warn_once
("lockd: unhandled internal status %u"). The status is
returned unchanged so the reply is still dropped, but every
dropped reply on a !CONFIG_LOCKD_V4 build emits a spurious
warning.
Compare against nlm__int__drop_reply directly so the warning
still catches the genuinely unexpected sentinels deadlock,
stale_fh, and failed (30001 through 30003) but excludes the
legitimate dropped-reply marker.
Fixes: d343fce148a4 ("[PATCH] knfsd: Allow lockd to drop replies as appropriate")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index c0a3487719e2..110e186802b6 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -49,7 +49,7 @@ static inline __be32 cast_status(__be32 status)
status = nlm_lck_denied_nolocks;
break;
default:
- if (be32_to_cpu(status) >= 30000)
+ if (be32_to_cpu(status) > be32_to_cpu(nlm__int__drop_reply))
pr_warn_once("lockd: unhandled internal status %u\n",
be32_to_cpu(status));
break;
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 02/38] lockd: Correct kernel-doc status descriptions for NLMv4 GRANTED
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
2026-05-12 18:13 ` [PATCH 01/38] lockd: Stop warning on nlm__int__drop_reply in !V4 cast_status Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 03/38] lockd: Drop locks_init_lock() from nlm4_lock_to_lockd_lock() Chuck Lever
` (36 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
NLM_GRANTED is a server-to-client callback; the local node
responds in the role of the client. The kernel-doc for
nlm4svc_proc_granted attributes NLM4_DENIED and
NLM4_DENIED_GRACE_PERIOD to "the server", but per the Open
Group XNFS specification the responder for this procedure is
the client host, and NLM4_DENIED_GRACE_PERIOD identifies the
client's own grace period after a reboot, not the server's.
Rewrite the descriptions to match the spec: NLM4_DENIED
reflects the generic internal-resource-constraint failure, and
NLM4_DENIED_GRACE_PERIOD attributes the grace period to the
client host that received the callback.
Fixes: 7a9f7c8f934e ("lockd: Use xdrgen XDR functions for the NLMv4 GRANTED procedure")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svc4proc.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index 41cab858de57..fc9ed4abb7ca 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -513,12 +513,12 @@ nlm4svc_proc_unlock(struct svc_rqst *rqstp)
* nlm4_res NLMPROC4_GRANTED(nlm4_testargs) = 5;
*
* Permissible procedure status codes:
- * %NLM4_GRANTED: The requested lock was granted.
- * %NLM4_DENIED: The server could not allocate the resources
- * needed to process the request.
- * %NLM4_DENIED_GRACE_PERIOD: The server has recently restarted and is
- * re-establishing existing locks, and is not
- * yet ready to accept normal service requests.
+ * %NLM4_GRANTED: The granted lock was accepted.
+ * %NLM4_DENIED: The procedure failed, possibly due to
+ * internal resource constraints.
+ * %NLM4_DENIED_GRACE_PERIOD: The client host recently restarted and
+ * its NLM is re-establishing existing locks,
+ * so it is not yet ready to accept callbacks.
*/
static __be32
nlm4svc_proc_granted(struct svc_rqst *rqstp)
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 03/38] lockd: Drop locks_init_lock() from nlm4_lock_to_lockd_lock()
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
2026-05-12 18:13 ` [PATCH 01/38] lockd: Stop warning on nlm__int__drop_reply in !V4 cast_status Chuck Lever
2026-05-12 18:13 ` [PATCH 02/38] lockd: Correct kernel-doc status descriptions for NLMv4 GRANTED Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 04/38] lockd: Translate nlm__int__deadlock in __nlm4svc_proc_lock_msg() Chuck Lever
` (35 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
The NLMv4 GRANTED helper passes the wrapper's lock to
nlmclnt_grant(), which compares only fl_start, fl_end, svid, and
fh, and the shared nlmclnt_lock_event tracepoint now sources its
byte-range fields from fl_start and fl_end as well. Both fl_start
and fl_end are set unconditionally by lockd_set_file_lock_range4()
on the line below, so the locks_init_lock() call left no observable
effect: every other field of struct file_lock is unread on the
GRANTED path.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svc4proc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index fc9ed4abb7ca..2bd71bc2b481 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -119,7 +119,6 @@ nlm4_lock_to_nlm_lock(struct nlm_lock *lock, struct nlm4_lock *alock)
lock->oh.len = alock->oh.len;
lock->oh.data = alock->oh.data;
lock->svid = alock->svid;
- locks_init_lock(&lock->fl);
lockd_set_file_lock_range4(&lock->fl, alock->l_offset, alock->l_len);
return nlm_granted;
}
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 04/38] lockd: Translate nlm__int__deadlock in __nlm4svc_proc_lock_msg()
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (2 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 03/38] lockd: Drop locks_init_lock() from nlm4_lock_to_lockd_lock() Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 05/38] lockd: Do not monitor when looking up the LOCK_MSG callback host Chuck Lever
` (34 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
When nlmsvc_lock() detects a deadlock it returns the internal
sentinel nlm__int__deadlock (30001), which version-specific
handlers must translate to a wire-valid status before the reply
is encoded. The xdrgen LOCK_MSG handler stores the sentinel
unmodified in resp->status; the LOCK_RES callback then places
30001 on the v4 wire, where the client rejects the reply.
Commit 9e0d0c619407 ("lockd: Introduce nlm__int__deadlock")
established the translation boundary and updated the synchronous
v4 path nlm4svc_do_lock(), but the xdrgen LOCK_MSG handler added
later in commit b2be4e28c23a ("lockd: Use xdrgen XDR functions
for the NLMv4 LOCK_MSG procedure") missed the corresponding
remap. Apply the same translation in __nlm4svc_proc_lock_msg()
so deadlock results are reported as nlm4_deadlock on LOCK_RES.
Fixes: b2be4e28c23a ("lockd: Use xdrgen XDR functions for the NLMv4 LOCK_MSG procedure")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svc4proc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index 2bd71bc2b481..886b56317e5f 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -668,6 +668,8 @@ __nlm4svc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_res *resp)
resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock,
argp->xdrgen.block, &resp->cookie,
argp->xdrgen.reclaim);
+ if (resp->status == nlm__int__deadlock)
+ resp->status = nlm4_deadlock;
nlmsvc_release_lockowner(&argp->lock);
out:
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 05/38] lockd: Do not monitor when looking up the LOCK_MSG callback host
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (3 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 04/38] lockd: Translate nlm__int__deadlock in __nlm4svc_proc_lock_msg() Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 06/38] Documentation: Add the RPC language description of NLM version 3 Chuck Lever
` (33 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
A LOCK_MSG handler that fails to obtain a host returns
rpc_system_err, which causes the dispatcher to send an RPC-level
error rather than an NLM LOCK_RES denial. Before the xdrgen
conversion, the outer host lookup was unmonitored, so an NSM
upcall failure was reported back to the client through LOCK_RES
with status nlm_lck_denied_nolocks generated by the inner helper.
The xdrgen conversion replaced the unmonitored lookup with
nlm4svc_lookup_host(..., true). When nsm_monitor() fails, the
outer lookup now returns NULL, so the procedure short-circuits to
rpc_system_err and __nlm4svc_proc_lock_msg() never runs. The
client therefore receives no LOCK_RES, regressing the legacy
behavior.
The inner helper still performs a monitored lookup while building
the LOCK_RES, so the outer call only needs an unmonitored host
reference for the callback path. Pass false here to restore the
previous semantics.
Fixes: b2be4e28c23a ("lockd: Use xdrgen XDR functions for the NLMv4 LOCK_MSG procedure")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svc4proc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index 886b56317e5f..e3a6d69c1fa6 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -698,7 +698,7 @@ static __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp)
struct nlm4_lockargs_wrapper *argp = rqstp->rq_argp;
struct nlm_host *host;
- host = nlm4svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, true);
+ host = nlm4svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
if (!host)
return rpc_system_err;
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 06/38] Documentation: Add the RPC language description of NLM version 3
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (4 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 05/38] lockd: Do not monitor when looking up the LOCK_MSG callback host Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 07/38] lockd: Rename struct nlm_cookie to lockd_cookie Chuck Lever
` (32 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
In order to generate source code to encode and decode NLMv3 protocol
elements, include a copy of the RPC language description of NLMv3
for xdrgen to process. The language description is derived from the
Open Group's XNFS specification:
https://pubs.opengroup.org/onlinepubs/9629799/chap10.htm#tagcjh_11_03
The C code committed here was generated from the new nlm3.x file
using tools/net/sunrpc/xdrgen/xdrgen.
The goals of replacing hand-written XDR functions with ones that
are tool-generated are to improve memory safety and make XDR
encoding and decoding less brittle to maintain. Parts of the
NFSv4 protocol are still being extended actively. Tool-generated
XDR code reduces the time it takes to get a working implementation
of new protocol elements.
The xdrgen utility derives both the type definitions and the
encode/decode functions directly from protocol specifications,
using names and symbols familiar to anyone who knows those specs.
Unlike hand-written code that can inadvertently diverge from the
specification, xdrgen guarantees that the generated code matches
the specification exactly.
We would eventually like xdrgen to generate Rust code as well,
making the conversion of the kernel's NFS stacks to use Rust just
a little easier for us.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
Documentation/sunrpc/xdr/nlm3.x | 168 +++++++++
fs/lockd/Makefile | 19 +-
fs/lockd/nlm3xdr_gen.c | 714 +++++++++++++++++++++++++++++++++++++
fs/lockd/nlm3xdr_gen.h | 32 ++
include/linux/sunrpc/xdrgen/nlm3.h | 210 +++++++++++
5 files changed, 1139 insertions(+), 4 deletions(-)
diff --git a/Documentation/sunrpc/xdr/nlm3.x b/Documentation/sunrpc/xdr/nlm3.x
new file mode 100644
index 000000000000..b2e704f7b864
--- /dev/null
+++ b/Documentation/sunrpc/xdr/nlm3.x
@@ -0,0 +1,168 @@
+/*
+ * This file was extracted by hand from
+ * https://pubs.opengroup.org/onlinepubs/9629799/chap10.htm#tagcjh_11_03
+ */
+
+/*
+ * The NLMv3 protocol
+ */
+
+pragma header nlm3;
+
+const LM_MAXSTRLEN = 1024;
+
+const LM_MAXNAMELEN = 1025;
+
+const MAXNETOBJ_SZ = 1024;
+
+typedef opaque netobj<MAXNETOBJ_SZ>;
+
+enum nlm_stats {
+ LCK_GRANTED = 0,
+ LCK_DENIED = 1,
+ LCK_DENIED_NOLOCKS = 2,
+ LCK_BLOCKED = 3,
+ LCK_DENIED_GRACE_PERIOD = 4
+};
+
+pragma big_endian nlm_stats;
+
+struct nlm_stat {
+ nlm_stats stat;
+};
+
+struct nlm_res {
+ netobj cookie;
+ nlm_stat stat;
+};
+
+struct nlm_holder {
+ bool exclusive;
+ int uppid;
+ netobj oh;
+ unsigned int l_offset;
+ unsigned int l_len;
+};
+
+union nlm_testrply switch (nlm_stats stat) {
+ case LCK_DENIED:
+ nlm_holder holder;
+ default:
+ void;
+};
+
+struct nlm_testres {
+ netobj cookie;
+ nlm_testrply test_stat;
+};
+
+struct nlm_lock {
+ string caller_name<LM_MAXSTRLEN>;
+ netobj fh;
+ netobj oh;
+ int uppid;
+ unsigned int l_offset;
+ unsigned int l_len;
+};
+
+struct nlm_lockargs {
+ netobj cookie;
+ bool block;
+ bool exclusive;
+ nlm_lock alock;
+ bool reclaim;
+ int state;
+};
+
+struct nlm_cancargs {
+ netobj cookie;
+ bool block;
+ bool exclusive;
+ nlm_lock alock;
+};
+
+struct nlm_testargs {
+ netobj cookie;
+ bool exclusive;
+ nlm_lock alock;
+};
+
+struct nlm_unlockargs {
+ netobj cookie;
+ nlm_lock alock;
+};
+
+enum fsh_mode {
+ fsm_DN = 0,
+ fsm_DR = 1,
+ fsm_DW = 2,
+ fsm_DRW = 3
+};
+
+enum fsh_access {
+ fsa_NONE = 0,
+ fsa_R = 1,
+ fsa_W = 2,
+ fsa_RW = 3
+};
+
+struct nlm_share {
+ string caller_name<LM_MAXSTRLEN>;
+ netobj fh;
+ netobj oh;
+ fsh_mode mode;
+ fsh_access access;
+};
+
+struct nlm_shareargs {
+ netobj cookie;
+ nlm_share share;
+ bool reclaim;
+};
+
+struct nlm_shareres {
+ netobj cookie;
+ nlm_stats stat;
+ int sequence;
+};
+
+struct nlm_notify {
+ string name<LM_MAXNAMELEN>;
+ long state;
+};
+
+/*
+ * Argument for the Linux-private SM_NOTIFY procedure
+ */
+const SM_PRIV_SIZE = 16;
+
+struct nlm_notifyargs {
+ nlm_notify notify;
+ opaque private[SM_PRIV_SIZE];
+};
+
+program NLM_PROG {
+ version NLM_VERS {
+ void NLM_NULL(void) = 0;
+ nlm_testres NLM_TEST(nlm_testargs) = 1;
+ nlm_res NLM_LOCK(nlm_lockargs) = 2;
+ nlm_res NLM_CANCEL(nlm_cancargs) = 3;
+ nlm_res NLM_UNLOCK(nlm_unlockargs) = 4;
+ nlm_res NLM_GRANTED(nlm_testargs) = 5;
+ void NLM_TEST_MSG(nlm_testargs) = 6;
+ void NLM_LOCK_MSG(nlm_lockargs) = 7;
+ void NLM_CANCEL_MSG(nlm_cancargs) = 8;
+ void NLM_UNLOCK_MSG(nlm_unlockargs) = 9;
+ void NLM_GRANTED_MSG(nlm_testargs) = 10;
+ void NLM_TEST_RES(nlm_testres) = 11;
+ void NLM_LOCK_RES(nlm_res) = 12;
+ void NLM_CANCEL_RES(nlm_res) = 13;
+ void NLM_UNLOCK_RES(nlm_res) = 14;
+ void NLM_GRANTED_RES(nlm_res) = 15;
+ void NLM_SM_NOTIFY(nlm_notifyargs) = 16;
+ nlm_shareres NLM_SHARE(nlm_shareargs) = 20;
+ nlm_shareres NLM_UNSHARE(nlm_shareargs) = 21;
+ nlm_res NLM_NM_LOCK(nlm_lockargs) = 22;
+ void NLM_FREE_ALL(nlm_notify) = 23;
+ } = 3;
+} = 100021;
diff --git a/fs/lockd/Makefile b/fs/lockd/Makefile
index 808f0f2a7be1..951a74e4847a 100644
--- a/fs/lockd/Makefile
+++ b/fs/lockd/Makefile
@@ -8,7 +8,8 @@ ccflags-y += -I$(src) # needed for trace events
obj-$(CONFIG_LOCKD) += lockd.o
lockd-y := clntlock.o clntproc.o clntxdr.o host.o svc.o svclock.o \
- svcshare.o svcproc.o svcsubs.o mon.o trace.o xdr.o netlink.o
+ svcshare.o svcproc.o svcsubs.o mon.o trace.o xdr.o netlink.o \
+ nlm3xdr_gen.o
lockd-$(CONFIG_LOCKD_V4) += clnt4xdr.o svc4proc.o nlm4xdr_gen.o
lockd-$(CONFIG_PROC_FS) += procfs.o
@@ -25,17 +26,27 @@ lockd-$(CONFIG_PROC_FS) += procfs.o
XDRGEN = ../../tools/net/sunrpc/xdrgen/xdrgen
-XDRGEN_DEFINITIONS = ../../include/linux/sunrpc/xdrgen/nlm4.h
-XDRGEN_DECLARATIONS = nlm4xdr_gen.h
-XDRGEN_SOURCE = nlm4xdr_gen.c
+XDRGEN_DEFINITIONS = ../../include/linux/sunrpc/xdrgen/nlm4.h \
+ ../../include/linux/sunrpc/xdrgen/nlm3.h
+XDRGEN_DECLARATIONS = nlm4xdr_gen.h nlm3xdr_gen.h
+XDRGEN_SOURCE = nlm4xdr_gen.c nlm3xdr_gen.c
xdrgen: $(XDRGEN_DEFINITIONS) $(XDRGEN_DECLARATIONS) $(XDRGEN_SOURCE)
../../include/linux/sunrpc/xdrgen/nlm4.h: ../../Documentation/sunrpc/xdr/nlm4.x
$(XDRGEN) definitions $< > $@
+../../include/linux/sunrpc/xdrgen/nlm3.h: ../../Documentation/sunrpc/xdr/nlm3.x
+ $(XDRGEN) definitions $< > $@
+
nlm4xdr_gen.h: ../../Documentation/sunrpc/xdr/nlm4.x
$(XDRGEN) declarations $< > $@
+nlm3xdr_gen.h: ../../Documentation/sunrpc/xdr/nlm3.x
+ $(XDRGEN) declarations $< > $@
+
nlm4xdr_gen.c: ../../Documentation/sunrpc/xdr/nlm4.x
$(XDRGEN) source --peer server $< > $@
+
+nlm3xdr_gen.c: ../../Documentation/sunrpc/xdr/nlm3.x
+ $(XDRGEN) source --peer server $< > $@
diff --git a/fs/lockd/nlm3xdr_gen.c b/fs/lockd/nlm3xdr_gen.c
new file mode 100644
index 000000000000..9ed5a41b5daf
--- /dev/null
+++ b/fs/lockd/nlm3xdr_gen.c
@@ -0,0 +1,714 @@
+// SPDX-License-Identifier: GPL-2.0
+// Generated by xdrgen. Manual edits will be lost.
+// XDR specification file: ../../Documentation/sunrpc/xdr/nlm3.x
+// XDR specification modification time: Thu Apr 23 10:56:34 2026
+
+#include <linux/sunrpc/svc.h>
+
+#include "nlm3xdr_gen.h"
+
+static bool __maybe_unused
+xdrgen_decode_netobj(struct xdr_stream *xdr, netobj *ptr)
+{
+ return xdrgen_decode_opaque(xdr, ptr, MAXNETOBJ_SZ);
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_stats(struct xdr_stream *xdr, nlm_stats *ptr)
+{
+ __be32 raw;
+ u32 val;
+
+ if (xdr_stream_decode_be32(xdr, &raw) < 0)
+ return false;
+ val = be32_to_cpu(raw);
+ /* Compiler may optimize to a range check for dense enums */
+ switch (val) {
+ case LCK_GRANTED:
+ case LCK_DENIED:
+ case LCK_DENIED_NOLOCKS:
+ case LCK_BLOCKED:
+ case LCK_DENIED_GRACE_PERIOD:
+ break;
+ default:
+ return false;
+ }
+ *ptr = raw;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_stat(struct xdr_stream *xdr, struct nlm_stat *ptr)
+{
+ if (!xdrgen_decode_nlm_stats(xdr, &ptr->stat))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_res(struct xdr_stream *xdr, struct nlm_res *ptr)
+{
+ if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
+ return false;
+ if (!xdrgen_decode_nlm_stat(xdr, &ptr->stat))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_holder(struct xdr_stream *xdr, struct nlm_holder *ptr)
+{
+ if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
+ return false;
+ if (!xdrgen_decode_int(xdr, &ptr->uppid))
+ return false;
+ if (!xdrgen_decode_netobj(xdr, &ptr->oh))
+ return false;
+ if (!xdrgen_decode_unsigned_int(xdr, &ptr->l_offset))
+ return false;
+ if (!xdrgen_decode_unsigned_int(xdr, &ptr->l_len))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_testrply(struct xdr_stream *xdr, struct nlm_testrply *ptr)
+{
+ if (!xdrgen_decode_nlm_stats(xdr, &ptr->stat))
+ return false;
+ switch (ptr->stat) {
+ case __constant_cpu_to_be32(LCK_DENIED):
+ if (!xdrgen_decode_nlm_holder(xdr, &ptr->u.holder))
+ return false;
+ break;
+ default:
+ break;
+ }
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_testres(struct xdr_stream *xdr, struct nlm_testres *ptr)
+{
+ if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
+ return false;
+ if (!xdrgen_decode_nlm_testrply(xdr, &ptr->test_stat))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_lock(struct xdr_stream *xdr, struct nlm_lock *ptr)
+{
+ if (!xdrgen_decode_string(xdr, (string *)ptr, LM_MAXSTRLEN))
+ return false;
+ if (!xdrgen_decode_netobj(xdr, &ptr->fh))
+ return false;
+ if (!xdrgen_decode_netobj(xdr, &ptr->oh))
+ return false;
+ if (!xdrgen_decode_int(xdr, &ptr->uppid))
+ return false;
+ if (!xdrgen_decode_unsigned_int(xdr, &ptr->l_offset))
+ return false;
+ if (!xdrgen_decode_unsigned_int(xdr, &ptr->l_len))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_lockargs(struct xdr_stream *xdr, struct nlm_lockargs *ptr)
+{
+ if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
+ return false;
+ if (!xdrgen_decode_bool(xdr, &ptr->block))
+ return false;
+ if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
+ return false;
+ if (!xdrgen_decode_nlm_lock(xdr, &ptr->alock))
+ return false;
+ if (!xdrgen_decode_bool(xdr, &ptr->reclaim))
+ return false;
+ if (!xdrgen_decode_int(xdr, &ptr->state))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_cancargs(struct xdr_stream *xdr, struct nlm_cancargs *ptr)
+{
+ if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
+ return false;
+ if (!xdrgen_decode_bool(xdr, &ptr->block))
+ return false;
+ if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
+ return false;
+ if (!xdrgen_decode_nlm_lock(xdr, &ptr->alock))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_testargs(struct xdr_stream *xdr, struct nlm_testargs *ptr)
+{
+ if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
+ return false;
+ if (!xdrgen_decode_bool(xdr, &ptr->exclusive))
+ return false;
+ if (!xdrgen_decode_nlm_lock(xdr, &ptr->alock))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_unlockargs(struct xdr_stream *xdr, struct nlm_unlockargs *ptr)
+{
+ if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
+ return false;
+ if (!xdrgen_decode_nlm_lock(xdr, &ptr->alock))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_fsh_mode(struct xdr_stream *xdr, fsh_mode *ptr)
+{
+ u32 val;
+
+ if (xdr_stream_decode_u32(xdr, &val) < 0)
+ return false;
+ /* Compiler may optimize to a range check for dense enums */
+ switch (val) {
+ case fsm_DN:
+ case fsm_DR:
+ case fsm_DW:
+ case fsm_DRW:
+ break;
+ default:
+ return false;
+ }
+ *ptr = val;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_fsh_access(struct xdr_stream *xdr, fsh_access *ptr)
+{
+ u32 val;
+
+ if (xdr_stream_decode_u32(xdr, &val) < 0)
+ return false;
+ /* Compiler may optimize to a range check for dense enums */
+ switch (val) {
+ case fsa_NONE:
+ case fsa_R:
+ case fsa_W:
+ case fsa_RW:
+ break;
+ default:
+ return false;
+ }
+ *ptr = val;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_share(struct xdr_stream *xdr, struct nlm_share *ptr)
+{
+ if (!xdrgen_decode_string(xdr, (string *)ptr, LM_MAXSTRLEN))
+ return false;
+ if (!xdrgen_decode_netobj(xdr, &ptr->fh))
+ return false;
+ if (!xdrgen_decode_netobj(xdr, &ptr->oh))
+ return false;
+ if (!xdrgen_decode_fsh_mode(xdr, &ptr->mode))
+ return false;
+ if (!xdrgen_decode_fsh_access(xdr, &ptr->access))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_shareargs(struct xdr_stream *xdr, struct nlm_shareargs *ptr)
+{
+ if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
+ return false;
+ if (!xdrgen_decode_nlm_share(xdr, &ptr->share))
+ return false;
+ if (!xdrgen_decode_bool(xdr, &ptr->reclaim))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_shareres(struct xdr_stream *xdr, struct nlm_shareres *ptr)
+{
+ if (!xdrgen_decode_netobj(xdr, &ptr->cookie))
+ return false;
+ if (!xdrgen_decode_nlm_stats(xdr, &ptr->stat))
+ return false;
+ if (!xdrgen_decode_int(xdr, &ptr->sequence))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_notify(struct xdr_stream *xdr, struct nlm_notify *ptr)
+{
+ if (!xdrgen_decode_string(xdr, (string *)ptr, LM_MAXNAMELEN))
+ return false;
+ if (!xdrgen_decode_long(xdr, &ptr->state))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_decode_nlm_notifyargs(struct xdr_stream *xdr, struct nlm_notifyargs *ptr)
+{
+ if (!xdrgen_decode_nlm_notify(xdr, &ptr->notify))
+ return false;
+ if (xdr_stream_decode_opaque_fixed(xdr, ptr->private, SM_PRIV_SIZE) < 0)
+ return false;
+ return true;
+}
+
+/**
+ * nlm_svc_decode_void - Decode a void argument
+ * @rqstp: RPC transaction context
+ * @xdr: source XDR data stream
+ *
+ * Return values:
+ * %true: procedure arguments decoded successfully
+ * %false: decode failed
+ */
+bool nlm_svc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ return xdrgen_decode_void(xdr);
+}
+
+/**
+ * nlm_svc_decode_nlm_testargs - Decode a nlm_testargs argument
+ * @rqstp: RPC transaction context
+ * @xdr: source XDR data stream
+ *
+ * Return values:
+ * %true: procedure arguments decoded successfully
+ * %false: decode failed
+ */
+bool nlm_svc_decode_nlm_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ struct nlm_testargs *argp = rqstp->rq_argp;
+
+ return xdrgen_decode_nlm_testargs(xdr, argp);
+}
+
+/**
+ * nlm_svc_decode_nlm_lockargs - Decode a nlm_lockargs argument
+ * @rqstp: RPC transaction context
+ * @xdr: source XDR data stream
+ *
+ * Return values:
+ * %true: procedure arguments decoded successfully
+ * %false: decode failed
+ */
+bool nlm_svc_decode_nlm_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ struct nlm_lockargs *argp = rqstp->rq_argp;
+
+ return xdrgen_decode_nlm_lockargs(xdr, argp);
+}
+
+/**
+ * nlm_svc_decode_nlm_cancargs - Decode a nlm_cancargs argument
+ * @rqstp: RPC transaction context
+ * @xdr: source XDR data stream
+ *
+ * Return values:
+ * %true: procedure arguments decoded successfully
+ * %false: decode failed
+ */
+bool nlm_svc_decode_nlm_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ struct nlm_cancargs *argp = rqstp->rq_argp;
+
+ return xdrgen_decode_nlm_cancargs(xdr, argp);
+}
+
+/**
+ * nlm_svc_decode_nlm_unlockargs - Decode a nlm_unlockargs argument
+ * @rqstp: RPC transaction context
+ * @xdr: source XDR data stream
+ *
+ * Return values:
+ * %true: procedure arguments decoded successfully
+ * %false: decode failed
+ */
+bool nlm_svc_decode_nlm_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ struct nlm_unlockargs *argp = rqstp->rq_argp;
+
+ return xdrgen_decode_nlm_unlockargs(xdr, argp);
+}
+
+/**
+ * nlm_svc_decode_nlm_testres - Decode a nlm_testres argument
+ * @rqstp: RPC transaction context
+ * @xdr: source XDR data stream
+ *
+ * Return values:
+ * %true: procedure arguments decoded successfully
+ * %false: decode failed
+ */
+bool nlm_svc_decode_nlm_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ struct nlm_testres *argp = rqstp->rq_argp;
+
+ return xdrgen_decode_nlm_testres(xdr, argp);
+}
+
+/**
+ * nlm_svc_decode_nlm_res - Decode a nlm_res argument
+ * @rqstp: RPC transaction context
+ * @xdr: source XDR data stream
+ *
+ * Return values:
+ * %true: procedure arguments decoded successfully
+ * %false: decode failed
+ */
+bool nlm_svc_decode_nlm_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ struct nlm_res *argp = rqstp->rq_argp;
+
+ return xdrgen_decode_nlm_res(xdr, argp);
+}
+
+/**
+ * nlm_svc_decode_nlm_notifyargs - Decode a nlm_notifyargs argument
+ * @rqstp: RPC transaction context
+ * @xdr: source XDR data stream
+ *
+ * Return values:
+ * %true: procedure arguments decoded successfully
+ * %false: decode failed
+ */
+bool nlm_svc_decode_nlm_notifyargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ struct nlm_notifyargs *argp = rqstp->rq_argp;
+
+ return xdrgen_decode_nlm_notifyargs(xdr, argp);
+}
+
+/**
+ * nlm_svc_decode_nlm_shareargs - Decode a nlm_shareargs argument
+ * @rqstp: RPC transaction context
+ * @xdr: source XDR data stream
+ *
+ * Return values:
+ * %true: procedure arguments decoded successfully
+ * %false: decode failed
+ */
+bool nlm_svc_decode_nlm_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ struct nlm_shareargs *argp = rqstp->rq_argp;
+
+ return xdrgen_decode_nlm_shareargs(xdr, argp);
+}
+
+/**
+ * nlm_svc_decode_nlm_notify - Decode a nlm_notify argument
+ * @rqstp: RPC transaction context
+ * @xdr: source XDR data stream
+ *
+ * Return values:
+ * %true: procedure arguments decoded successfully
+ * %false: decode failed
+ */
+bool nlm_svc_decode_nlm_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ struct nlm_notify *argp = rqstp->rq_argp;
+
+ return xdrgen_decode_nlm_notify(xdr, argp);
+}
+
+static bool __maybe_unused
+xdrgen_encode_netobj(struct xdr_stream *xdr, const netobj value)
+{
+ return xdr_stream_encode_opaque(xdr, value.data, value.len) >= 0;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_stats(struct xdr_stream *xdr, nlm_stats value)
+{
+ return xdr_stream_encode_be32(xdr, value) == XDR_UNIT;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_stat(struct xdr_stream *xdr, const struct nlm_stat *value)
+{
+ if (!xdrgen_encode_nlm_stats(xdr, value->stat))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_res(struct xdr_stream *xdr, const struct nlm_res *value)
+{
+ if (!xdrgen_encode_netobj(xdr, value->cookie))
+ return false;
+ if (!xdrgen_encode_nlm_stat(xdr, &value->stat))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_holder(struct xdr_stream *xdr, const struct nlm_holder *value)
+{
+ if (!xdrgen_encode_bool(xdr, value->exclusive))
+ return false;
+ if (!xdrgen_encode_int(xdr, value->uppid))
+ return false;
+ if (!xdrgen_encode_netobj(xdr, value->oh))
+ return false;
+ if (!xdrgen_encode_unsigned_int(xdr, value->l_offset))
+ return false;
+ if (!xdrgen_encode_unsigned_int(xdr, value->l_len))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_testrply(struct xdr_stream *xdr, const struct nlm_testrply *ptr)
+{
+ if (!xdrgen_encode_nlm_stats(xdr, ptr->stat))
+ return false;
+ switch (ptr->stat) {
+ case __constant_cpu_to_be32(LCK_DENIED):
+ if (!xdrgen_encode_nlm_holder(xdr, &ptr->u.holder))
+ return false;
+ break;
+ default:
+ break;
+ }
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_testres(struct xdr_stream *xdr, const struct nlm_testres *value)
+{
+ if (!xdrgen_encode_netobj(xdr, value->cookie))
+ return false;
+ if (!xdrgen_encode_nlm_testrply(xdr, &value->test_stat))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_lock(struct xdr_stream *xdr, const struct nlm_lock *value)
+{
+ if (value->caller_name.len > LM_MAXSTRLEN)
+ return false;
+ if (xdr_stream_encode_opaque(xdr, value->caller_name.data, value->caller_name.len) < 0)
+ return false;
+ if (!xdrgen_encode_netobj(xdr, value->fh))
+ return false;
+ if (!xdrgen_encode_netobj(xdr, value->oh))
+ return false;
+ if (!xdrgen_encode_int(xdr, value->uppid))
+ return false;
+ if (!xdrgen_encode_unsigned_int(xdr, value->l_offset))
+ return false;
+ if (!xdrgen_encode_unsigned_int(xdr, value->l_len))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_lockargs(struct xdr_stream *xdr, const struct nlm_lockargs *value)
+{
+ if (!xdrgen_encode_netobj(xdr, value->cookie))
+ return false;
+ if (!xdrgen_encode_bool(xdr, value->block))
+ return false;
+ if (!xdrgen_encode_bool(xdr, value->exclusive))
+ return false;
+ if (!xdrgen_encode_nlm_lock(xdr, &value->alock))
+ return false;
+ if (!xdrgen_encode_bool(xdr, value->reclaim))
+ return false;
+ if (!xdrgen_encode_int(xdr, value->state))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_cancargs(struct xdr_stream *xdr, const struct nlm_cancargs *value)
+{
+ if (!xdrgen_encode_netobj(xdr, value->cookie))
+ return false;
+ if (!xdrgen_encode_bool(xdr, value->block))
+ return false;
+ if (!xdrgen_encode_bool(xdr, value->exclusive))
+ return false;
+ if (!xdrgen_encode_nlm_lock(xdr, &value->alock))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_testargs(struct xdr_stream *xdr, const struct nlm_testargs *value)
+{
+ if (!xdrgen_encode_netobj(xdr, value->cookie))
+ return false;
+ if (!xdrgen_encode_bool(xdr, value->exclusive))
+ return false;
+ if (!xdrgen_encode_nlm_lock(xdr, &value->alock))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_unlockargs(struct xdr_stream *xdr, const struct nlm_unlockargs *value)
+{
+ if (!xdrgen_encode_netobj(xdr, value->cookie))
+ return false;
+ if (!xdrgen_encode_nlm_lock(xdr, &value->alock))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_fsh_mode(struct xdr_stream *xdr, fsh_mode value)
+{
+ return xdr_stream_encode_u32(xdr, value) == XDR_UNIT;
+}
+
+static bool __maybe_unused
+xdrgen_encode_fsh_access(struct xdr_stream *xdr, fsh_access value)
+{
+ return xdr_stream_encode_u32(xdr, value) == XDR_UNIT;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_share(struct xdr_stream *xdr, const struct nlm_share *value)
+{
+ if (value->caller_name.len > LM_MAXSTRLEN)
+ return false;
+ if (xdr_stream_encode_opaque(xdr, value->caller_name.data, value->caller_name.len) < 0)
+ return false;
+ if (!xdrgen_encode_netobj(xdr, value->fh))
+ return false;
+ if (!xdrgen_encode_netobj(xdr, value->oh))
+ return false;
+ if (!xdrgen_encode_fsh_mode(xdr, value->mode))
+ return false;
+ if (!xdrgen_encode_fsh_access(xdr, value->access))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_shareargs(struct xdr_stream *xdr, const struct nlm_shareargs *value)
+{
+ if (!xdrgen_encode_netobj(xdr, value->cookie))
+ return false;
+ if (!xdrgen_encode_nlm_share(xdr, &value->share))
+ return false;
+ if (!xdrgen_encode_bool(xdr, value->reclaim))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_shareres(struct xdr_stream *xdr, const struct nlm_shareres *value)
+{
+ if (!xdrgen_encode_netobj(xdr, value->cookie))
+ return false;
+ if (!xdrgen_encode_nlm_stats(xdr, value->stat))
+ return false;
+ if (!xdrgen_encode_int(xdr, value->sequence))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_notify(struct xdr_stream *xdr, const struct nlm_notify *value)
+{
+ if (value->name.len > LM_MAXNAMELEN)
+ return false;
+ if (xdr_stream_encode_opaque(xdr, value->name.data, value->name.len) < 0)
+ return false;
+ if (!xdrgen_encode_long(xdr, value->state))
+ return false;
+ return true;
+}
+
+static bool __maybe_unused
+xdrgen_encode_nlm_notifyargs(struct xdr_stream *xdr, const struct nlm_notifyargs *value)
+{
+ if (!xdrgen_encode_nlm_notify(xdr, &value->notify))
+ return false;
+ if (xdr_stream_encode_opaque_fixed(xdr, value->private, SM_PRIV_SIZE) < 0)
+ return false;
+ return true;
+}
+
+/**
+ * nlm_svc_encode_void - Encode a void result
+ * @rqstp: RPC transaction context
+ * @xdr: target XDR data stream
+ *
+ * Return values:
+ * %true: procedure results encoded successfully
+ * %false: encode failed
+ */
+bool nlm_svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ return xdrgen_encode_void(xdr);
+}
+
+/**
+ * nlm_svc_encode_nlm_testres - Encode a nlm_testres result
+ * @rqstp: RPC transaction context
+ * @xdr: target XDR data stream
+ *
+ * Return values:
+ * %true: procedure results encoded successfully
+ * %false: encode failed
+ */
+bool nlm_svc_encode_nlm_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ struct nlm_testres *resp = rqstp->rq_resp;
+
+ return xdrgen_encode_nlm_testres(xdr, resp);
+}
+
+/**
+ * nlm_svc_encode_nlm_res - Encode a nlm_res result
+ * @rqstp: RPC transaction context
+ * @xdr: target XDR data stream
+ *
+ * Return values:
+ * %true: procedure results encoded successfully
+ * %false: encode failed
+ */
+bool nlm_svc_encode_nlm_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ struct nlm_res *resp = rqstp->rq_resp;
+
+ return xdrgen_encode_nlm_res(xdr, resp);
+}
+
+/**
+ * nlm_svc_encode_nlm_shareres - Encode a nlm_shareres result
+ * @rqstp: RPC transaction context
+ * @xdr: target XDR data stream
+ *
+ * Return values:
+ * %true: procedure results encoded successfully
+ * %false: encode failed
+ */
+bool nlm_svc_encode_nlm_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
+{
+ struct nlm_shareres *resp = rqstp->rq_resp;
+
+ return xdrgen_encode_nlm_shareres(xdr, resp);
+}
diff --git a/fs/lockd/nlm3xdr_gen.h b/fs/lockd/nlm3xdr_gen.h
new file mode 100644
index 000000000000..c99038e99805
--- /dev/null
+++ b/fs/lockd/nlm3xdr_gen.h
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Generated by xdrgen. Manual edits will be lost. */
+/* XDR specification file: ../../Documentation/sunrpc/xdr/nlm3.x */
+/* XDR specification modification time: Thu Apr 23 10:56:34 2026 */
+
+#ifndef _LINUX_XDRGEN_NLM3_DECL_H
+#define _LINUX_XDRGEN_NLM3_DECL_H
+
+#include <linux/types.h>
+
+#include <linux/sunrpc/xdr.h>
+#include <linux/sunrpc/xdrgen/_defs.h>
+#include <linux/sunrpc/xdrgen/_builtins.h>
+#include <linux/sunrpc/xdrgen/nlm3.h>
+
+bool nlm_svc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+bool nlm_svc_decode_nlm_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+bool nlm_svc_decode_nlm_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+bool nlm_svc_decode_nlm_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+bool nlm_svc_decode_nlm_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+bool nlm_svc_decode_nlm_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+bool nlm_svc_decode_nlm_res(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+bool nlm_svc_decode_nlm_notifyargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+bool nlm_svc_decode_nlm_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+bool nlm_svc_decode_nlm_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+
+bool nlm_svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+bool nlm_svc_encode_nlm_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+bool nlm_svc_encode_nlm_res(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+bool nlm_svc_encode_nlm_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+
+#endif /* _LINUX_XDRGEN_NLM3_DECL_H */
diff --git a/include/linux/sunrpc/xdrgen/nlm3.h b/include/linux/sunrpc/xdrgen/nlm3.h
new file mode 100644
index 000000000000..897e7d91807c
--- /dev/null
+++ b/include/linux/sunrpc/xdrgen/nlm3.h
@@ -0,0 +1,210 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Generated by xdrgen. Manual edits will be lost. */
+/* XDR specification file: ../../Documentation/sunrpc/xdr/nlm3.x */
+/* XDR specification modification time: Thu Apr 23 10:56:34 2026 */
+
+#ifndef _LINUX_XDRGEN_NLM3_DEF_H
+#define _LINUX_XDRGEN_NLM3_DEF_H
+
+#include <linux/types.h>
+#include <linux/sunrpc/xdrgen/_defs.h>
+
+enum { LM_MAXSTRLEN = 1024 };
+
+enum { LM_MAXNAMELEN = 1025 };
+
+enum { MAXNETOBJ_SZ = 1024 };
+
+typedef opaque netobj;
+
+enum nlm_stats {
+ LCK_GRANTED = 0,
+ LCK_DENIED = 1,
+ LCK_DENIED_NOLOCKS = 2,
+ LCK_BLOCKED = 3,
+ LCK_DENIED_GRACE_PERIOD = 4,
+};
+
+typedef __be32 nlm_stats;
+
+struct nlm_stat {
+ nlm_stats stat;
+};
+
+struct nlm_res {
+ netobj cookie;
+ struct nlm_stat stat;
+};
+
+struct nlm_holder {
+ bool exclusive;
+ s32 uppid;
+ netobj oh;
+ u32 l_offset;
+ u32 l_len;
+};
+
+struct nlm_testrply {
+ nlm_stats stat;
+ union {
+ struct nlm_holder holder;
+ } u;
+};
+
+struct nlm_testres {
+ netobj cookie;
+ struct nlm_testrply test_stat;
+};
+
+struct nlm_lock {
+ string caller_name;
+ netobj fh;
+ netobj oh;
+ s32 uppid;
+ u32 l_offset;
+ u32 l_len;
+};
+
+struct nlm_lockargs {
+ netobj cookie;
+ bool block;
+ bool exclusive;
+ struct nlm_lock alock;
+ bool reclaim;
+ s32 state;
+};
+
+struct nlm_cancargs {
+ netobj cookie;
+ bool block;
+ bool exclusive;
+ struct nlm_lock alock;
+};
+
+struct nlm_testargs {
+ netobj cookie;
+ bool exclusive;
+ struct nlm_lock alock;
+};
+
+struct nlm_unlockargs {
+ netobj cookie;
+ struct nlm_lock alock;
+};
+
+enum fsh_mode {
+ fsm_DN = 0,
+ fsm_DR = 1,
+ fsm_DW = 2,
+ fsm_DRW = 3,
+};
+
+typedef enum fsh_mode fsh_mode;
+
+enum fsh_access {
+ fsa_NONE = 0,
+ fsa_R = 1,
+ fsa_W = 2,
+ fsa_RW = 3,
+};
+
+typedef enum fsh_access fsh_access;
+
+struct nlm_share {
+ string caller_name;
+ netobj fh;
+ netobj oh;
+ fsh_mode mode;
+ fsh_access access;
+};
+
+struct nlm_shareargs {
+ netobj cookie;
+ struct nlm_share share;
+ bool reclaim;
+};
+
+struct nlm_shareres {
+ netobj cookie;
+ nlm_stats stat;
+ s32 sequence;
+};
+
+struct nlm_notify {
+ string name;
+ s32 state;
+};
+
+enum { SM_PRIV_SIZE = 16 };
+
+struct nlm_notifyargs {
+ struct nlm_notify notify;
+ u8 private[SM_PRIV_SIZE];
+};
+
+enum {
+ NLM_NULL = 0,
+ NLM_TEST = 1,
+ NLM_LOCK = 2,
+ NLM_CANCEL = 3,
+ NLM_UNLOCK = 4,
+ NLM_GRANTED = 5,
+ NLM_TEST_MSG = 6,
+ NLM_LOCK_MSG = 7,
+ NLM_CANCEL_MSG = 8,
+ NLM_UNLOCK_MSG = 9,
+ NLM_GRANTED_MSG = 10,
+ NLM_TEST_RES = 11,
+ NLM_LOCK_RES = 12,
+ NLM_CANCEL_RES = 13,
+ NLM_UNLOCK_RES = 14,
+ NLM_GRANTED_RES = 15,
+ NLM_SM_NOTIFY = 16,
+ NLM_SHARE = 20,
+ NLM_UNSHARE = 21,
+ NLM_NM_LOCK = 22,
+ NLM_FREE_ALL = 23,
+};
+
+#ifndef NLM_PROG
+#define NLM_PROG (100021)
+#endif
+
+#define NLM3_netobj_sz (XDR_unsigned_int + XDR_QUADLEN(MAXNETOBJ_SZ))
+#define NLM3_nlm_stats_sz (XDR_int)
+#define NLM3_nlm_stat_sz \
+ (NLM3_nlm_stats_sz)
+#define NLM3_nlm_res_sz \
+ (NLM3_netobj_sz + NLM3_nlm_stat_sz)
+#define NLM3_nlm_holder_sz \
+ (XDR_bool + XDR_int + NLM3_netobj_sz + XDR_unsigned_int + XDR_unsigned_int)
+#define NLM3_nlm_testrply_sz \
+ (NLM3_nlm_stats_sz + NLM3_nlm_holder_sz)
+#define NLM3_nlm_testres_sz \
+ (NLM3_netobj_sz + NLM3_nlm_testrply_sz)
+#define NLM3_nlm_lock_sz \
+ (XDR_unsigned_int + XDR_QUADLEN(LM_MAXSTRLEN) + NLM3_netobj_sz + NLM3_netobj_sz + XDR_int + XDR_unsigned_int + XDR_unsigned_int)
+#define NLM3_nlm_lockargs_sz \
+ (NLM3_netobj_sz + XDR_bool + XDR_bool + NLM3_nlm_lock_sz + XDR_bool + XDR_int)
+#define NLM3_nlm_cancargs_sz \
+ (NLM3_netobj_sz + XDR_bool + XDR_bool + NLM3_nlm_lock_sz)
+#define NLM3_nlm_testargs_sz \
+ (NLM3_netobj_sz + XDR_bool + NLM3_nlm_lock_sz)
+#define NLM3_nlm_unlockargs_sz \
+ (NLM3_netobj_sz + NLM3_nlm_lock_sz)
+#define NLM3_fsh_mode_sz (XDR_int)
+#define NLM3_fsh_access_sz (XDR_int)
+#define NLM3_nlm_share_sz \
+ (XDR_unsigned_int + XDR_QUADLEN(LM_MAXSTRLEN) + NLM3_netobj_sz + NLM3_netobj_sz + NLM3_fsh_mode_sz + NLM3_fsh_access_sz)
+#define NLM3_nlm_shareargs_sz \
+ (NLM3_netobj_sz + NLM3_nlm_share_sz + XDR_bool)
+#define NLM3_nlm_shareres_sz \
+ (NLM3_netobj_sz + NLM3_nlm_stats_sz + XDR_int)
+#define NLM3_nlm_notify_sz \
+ (XDR_unsigned_int + XDR_QUADLEN(LM_MAXNAMELEN) + XDR_long)
+#define NLM3_nlm_notifyargs_sz \
+ (NLM3_nlm_notify_sz + XDR_QUADLEN(SM_PRIV_SIZE))
+#define NLM3_MAX_ARGS_SZ \
+ (NLM3_nlm_lockargs_sz)
+
+#endif /* _LINUX_XDRGEN_NLM3_DEF_H */
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 07/38] lockd: Rename struct nlm_cookie to lockd_cookie
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (5 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 06/38] Documentation: Add the RPC language description of NLM version 3 Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 08/38] lockd: Rename struct nlm_lock to lockd_lock Chuck Lever
` (31 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Machine-generated XDR types derived from the NLM specification
use names that match the protocol. Internal lockd types with
identical names cause compilation failures when machine-generated
encoders replace hand-coded ones.
Rename the internal struct nlm_cookie type to lockd_cookie to
prevent such collisions. The "lockd_" prefix distinguishes
implementation-specific types from specified NLM protocol types.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/clnt4xdr.c | 4 ++--
fs/lockd/clntproc.c | 2 +-
fs/lockd/clntxdr.c | 4 ++--
fs/lockd/lockd.h | 6 +++---
fs/lockd/svc4proc.c | 6 +++---
fs/lockd/svclock.c | 16 ++++++++--------
fs/lockd/svcxdr.h | 4 ++--
fs/lockd/xdr.h | 7 +++----
8 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index 2058733eacf8..6d881f9702a9 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -132,13 +132,13 @@ static int decode_netobj(struct xdr_stream *xdr,
* netobj cookie;
*/
static void encode_cookie(struct xdr_stream *xdr,
- const struct nlm_cookie *cookie)
+ const struct lockd_cookie *cookie)
{
encode_netobj(xdr, (u8 *)&cookie->data, cookie->len);
}
static int decode_cookie(struct xdr_stream *xdr,
- struct nlm_cookie *cookie)
+ struct lockd_cookie *cookie)
{
u32 length;
__be32 *p;
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index 7f211008a5d2..50cfab2f31c7 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -42,7 +42,7 @@ static const struct rpc_call_ops nlmclnt_cancel_ops;
*/
static atomic_t nlm_cookie = ATOMIC_INIT(0x1234);
-void nlmclnt_next_cookie(struct nlm_cookie *c)
+void nlmclnt_next_cookie(struct lockd_cookie *c)
{
u32 cookie = atomic_inc_return(&nlm_cookie);
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index 65555f5224b1..2a4d28847254 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -130,13 +130,13 @@ static int decode_netobj(struct xdr_stream *xdr,
* netobj cookie;
*/
static void encode_cookie(struct xdr_stream *xdr,
- const struct nlm_cookie *cookie)
+ const struct lockd_cookie *cookie)
{
encode_netobj(xdr, (u8 *)&cookie->data, cookie->len);
}
static int decode_cookie(struct xdr_stream *xdr,
- struct nlm_cookie *cookie)
+ struct lockd_cookie *cookie)
{
u32 length;
__be32 *p;
diff --git a/fs/lockd/lockd.h b/fs/lockd/lockd.h
index 1db6cb352542..119818568507 100644
--- a/fs/lockd/lockd.h
+++ b/fs/lockd/lockd.h
@@ -257,7 +257,7 @@ __be32 nlmclnt_grant(const struct sockaddr *addr,
void nlmclnt_recovery(struct nlm_host *);
int nlmclnt_reclaim(struct nlm_host *, struct file_lock *,
struct nlm_rqst *);
-void nlmclnt_next_cookie(struct nlm_cookie *);
+void nlmclnt_next_cookie(struct lockd_cookie *);
#ifdef CONFIG_LOCKD_V4
extern const struct rpc_version nlm_version4;
@@ -314,7 +314,7 @@ typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref);
int lock_to_openmode(struct file_lock *);
__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
struct nlm_host *, struct nlm_lock *, int,
- struct nlm_cookie *, int);
+ struct lockd_cookie *, int);
__be32 nlmsvc_unlock(struct net *net, struct nlm_file *, struct nlm_lock *);
__be32 nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
struct nlm_host *host, struct nlm_lock *lock,
@@ -323,7 +323,7 @@ __be32 nlmsvc_cancel_blocked(struct net *net, struct nlm_file *, struct nlm_l
void nlmsvc_retry_blocked(struct svc_rqst *rqstp);
void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
nlm_host_match_fn_t match);
-void nlmsvc_grant_reply(struct nlm_cookie *, __be32);
+void nlmsvc_grant_reply(struct lockd_cookie *, __be32);
void nlmsvc_release_call(struct nlm_rqst *);
void nlmsvc_locks_init_private(struct file_lock *, struct nlm_host *, pid_t);
int nlmsvc_dispatch(struct svc_rqst *rqstp);
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index e3a6d69c1fa6..249ef49f1bcd 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -39,7 +39,7 @@ static_assert(offsetof(struct nlm4_testargs_wrapper, xdrgen) == 0);
struct nlm4_lockargs_wrapper {
struct nlm4_lockargs xdrgen;
- struct nlm_cookie cookie;
+ struct lockd_cookie cookie;
struct nlm_lock lock;
};
@@ -88,7 +88,7 @@ static_assert(offsetof(struct nlm4_testres_wrapper, xdrgen) == 0);
struct nlm4_res_wrapper {
struct nlm4_res xdrgen;
- struct nlm_cookie cookie;
+ struct lockd_cookie cookie;
};
static_assert(offsetof(struct nlm4_res_wrapper, xdrgen) == 0);
@@ -100,7 +100,7 @@ struct nlm4_shareres_wrapper {
static_assert(offsetof(struct nlm4_shareres_wrapper, xdrgen) == 0);
static __be32
-nlm4_netobj_to_cookie(struct nlm_cookie *cookie, netobj *object)
+nlm4_netobj_to_cookie(struct lockd_cookie *cookie, netobj *object)
{
if (object->len > NLM_MAXCOOKIELEN)
return nlm_lck_denied_nolocks;
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index f4520149d6d7..7fb03042ebee 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -48,7 +48,7 @@ static LIST_HEAD(nlm_blocked);
static DEFINE_SPINLOCK(nlm_blocked_lock);
#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
-static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie)
+static const char *nlmdbg_cookie2a(const struct lockd_cookie *cookie)
{
/*
* We can get away with a static buffer because this is only called
@@ -75,7 +75,7 @@ static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie)
return buf;
}
#else
-static inline const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie)
+static inline const char *nlmdbg_cookie2a(const struct lockd_cookie *cookie)
{
return "???";
}
@@ -171,7 +171,7 @@ nlmsvc_lookup_block(struct nlm_file *file, struct nlm_lock *lock)
return NULL;
}
-static inline int nlm_cookie_match(struct nlm_cookie *a, struct nlm_cookie *b)
+static int lockd_cookie_match(struct lockd_cookie *a, struct lockd_cookie *b)
{
if (a->len != b->len)
return 0;
@@ -184,13 +184,13 @@ static inline int nlm_cookie_match(struct nlm_cookie *a, struct nlm_cookie *b)
* Find a block with a given NLM cookie.
*/
static inline struct nlm_block *
-nlmsvc_find_block(struct nlm_cookie *cookie)
+nlmsvc_find_block(struct lockd_cookie *cookie)
{
struct nlm_block *block;
spin_lock(&nlm_blocked_lock);
list_for_each_entry(block, &nlm_blocked, b_list) {
- if (nlm_cookie_match(&block->b_call->a_args.cookie,cookie))
+ if (lockd_cookie_match(&block->b_call->a_args.cookie, cookie))
goto found;
}
spin_unlock(&nlm_blocked_lock);
@@ -222,7 +222,7 @@ nlmsvc_find_block(struct nlm_cookie *cookie)
static struct nlm_block *
nlmsvc_create_block(struct svc_rqst *rqstp, struct nlm_host *host,
struct nlm_file *file, struct nlm_lock *lock,
- struct nlm_cookie *cookie)
+ struct lockd_cookie *cookie)
{
struct nlm_block *block;
struct nlm_rqst *call = NULL;
@@ -477,7 +477,7 @@ nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block)
__be32
nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
struct nlm_host *host, struct nlm_lock *lock, int wait,
- struct nlm_cookie *cookie, int reclaim)
+ struct lockd_cookie *cookie, int reclaim)
{
struct inode *inode __maybe_unused = nlmsvc_file_inode(file);
struct nlm_block *block = NULL;
@@ -982,7 +982,7 @@ static const struct rpc_call_ops nlmsvc_grant_ops = {
* block.
*/
void
-nlmsvc_grant_reply(struct nlm_cookie *cookie, __be32 status)
+nlmsvc_grant_reply(struct lockd_cookie *cookie, __be32 status)
{
struct nlm_block *block;
struct file_lock *fl;
diff --git a/fs/lockd/svcxdr.h b/fs/lockd/svcxdr.h
index 4f1a451da5ba..911b5fd707b1 100644
--- a/fs/lockd/svcxdr.h
+++ b/fs/lockd/svcxdr.h
@@ -70,7 +70,7 @@ svcxdr_decode_string(struct xdr_stream *xdr, char **data, unsigned int *data_len
* specially.
*/
static inline bool
-svcxdr_decode_cookie(struct xdr_stream *xdr, struct nlm_cookie *cookie)
+svcxdr_decode_cookie(struct xdr_stream *xdr, struct lockd_cookie *cookie)
{
__be32 *p;
u32 len;
@@ -98,7 +98,7 @@ svcxdr_decode_cookie(struct xdr_stream *xdr, struct nlm_cookie *cookie)
}
static inline bool
-svcxdr_encode_cookie(struct xdr_stream *xdr, const struct nlm_cookie *cookie)
+svcxdr_encode_cookie(struct xdr_stream *xdr, const struct lockd_cookie *cookie)
{
__be32 *p;
diff --git a/fs/lockd/xdr.h b/fs/lockd/xdr.h
index 3c60817c4349..c7e0518862d7 100644
--- a/fs/lockd/xdr.h
+++ b/fs/lockd/xdr.h
@@ -49,8 +49,7 @@ struct nlm_lock {
* 32 bytes.
*/
-struct nlm_cookie
-{
+struct lockd_cookie {
unsigned char data[NLM_MAXCOOKIELEN];
unsigned int len;
};
@@ -59,7 +58,7 @@ struct nlm_cookie
* Generic lockd arguments for all but sm_notify
*/
struct nlm_args {
- struct nlm_cookie cookie;
+ struct lockd_cookie cookie;
struct nlm_lock lock;
u32 block;
u32 reclaim;
@@ -73,7 +72,7 @@ struct nlm_args {
* Generic lockd result
*/
struct nlm_res {
- struct nlm_cookie cookie;
+ struct lockd_cookie cookie;
__be32 status;
struct nlm_lock lock;
};
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 08/38] lockd: Rename struct nlm_lock to lockd_lock
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (6 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 07/38] lockd: Rename struct nlm_cookie to lockd_cookie Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 09/38] lockd: Rename struct nlm_args to lockd_args Chuck Lever
` (30 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
A subsequent patch will convert fs/lockd/svcproc.c to use
machine-generated XDR encoding and decoding functions in a
manner similar to fs/lockd/svc4proc.c. Machine-generated
types derived from the NLM specification will conflict with
the internal types of the same name.
Rename the internal struct nlm_lock type to lockd_lock to
avoid such naming conflicts.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/clnt4xdr.c | 16 ++++++++--------
fs/lockd/clntlock.c | 2 +-
fs/lockd/clntproc.c | 2 +-
fs/lockd/clntxdr.c | 16 ++++++++--------
fs/lockd/lockd.h | 16 ++++++++--------
fs/lockd/svc4proc.c | 30 +++++++++++++++---------------
fs/lockd/svclock.c | 22 +++++++++++-----------
fs/lockd/svcproc.c | 2 +-
fs/lockd/svcsubs.c | 2 +-
fs/lockd/trace.h | 4 ++--
fs/lockd/xdr.c | 8 ++++----
fs/lockd/xdr.h | 6 +++---
12 files changed, 63 insertions(+), 63 deletions(-)
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index 6d881f9702a9..8973711264cb 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -63,7 +63,7 @@ static s64 loff_t_to_s64(loff_t offset)
return res;
}
-static void nlm4_compute_offsets(const struct nlm_lock *lock,
+static void nlm4_compute_offsets(const struct lockd_lock *lock,
u64 *l_offset, u64 *l_len)
{
const struct file_lock *fl = &lock->fl;
@@ -240,7 +240,7 @@ static int decode_nlm4_stat(struct xdr_stream *xdr, __be32 *stat)
static void encode_nlm4_holder(struct xdr_stream *xdr,
const struct nlm_res *result)
{
- const struct nlm_lock *lock = &result->lock;
+ const struct lockd_lock *lock = &result->lock;
u64 l_offset, l_len;
__be32 *p;
@@ -256,7 +256,7 @@ static void encode_nlm4_holder(struct xdr_stream *xdr,
static int decode_nlm4_holder(struct xdr_stream *xdr, struct nlm_res *result)
{
- struct nlm_lock *lock = &result->lock;
+ struct lockd_lock *lock = &result->lock;
struct file_lock *fl = &lock->fl;
u64 l_offset, l_len;
u32 exclusive;
@@ -317,7 +317,7 @@ static void encode_caller_name(struct xdr_stream *xdr, const char *name)
* };
*/
static void encode_nlm4_lock(struct xdr_stream *xdr,
- const struct nlm_lock *lock)
+ const struct lockd_lock *lock)
{
u64 l_offset, l_len;
__be32 *p;
@@ -355,7 +355,7 @@ static void nlm4_xdr_enc_testargs(struct rpc_rqst *req,
const void *data)
{
const struct nlm_args *args = data;
- const struct nlm_lock *lock = &args->lock;
+ const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
encode_bool(xdr, lock->fl.c.flc_type == F_WRLCK);
@@ -377,7 +377,7 @@ static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req,
const void *data)
{
const struct nlm_args *args = data;
- const struct nlm_lock *lock = &args->lock;
+ const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
encode_bool(xdr, args->block);
@@ -400,7 +400,7 @@ static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req,
const void *data)
{
const struct nlm_args *args = data;
- const struct nlm_lock *lock = &args->lock;
+ const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
encode_bool(xdr, args->block);
@@ -419,7 +419,7 @@ static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req,
const void *data)
{
const struct nlm_args *args = data;
- const struct nlm_lock *lock = &args->lock;
+ const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
encode_nlm4_lock(xdr, lock);
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index 8fa30c42c92a..f797cc99f94d 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -158,7 +158,7 @@ int nlmclnt_wait(struct nlm_wait *block, struct nlm_rqst *req, long timeout)
/*
* The server lockd has called us back to tell us the lock was granted
*/
-__be32 nlmclnt_grant(const struct sockaddr *addr, const struct nlm_lock *lock)
+__be32 nlmclnt_grant(const struct sockaddr *addr, const struct lockd_lock *lock)
{
const struct file_lock *fl = &lock->fl;
const struct nfs_fh *fh = &lock->fh;
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index 50cfab2f31c7..1aa6597ae0b7 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -129,7 +129,7 @@ static struct nlm_lockowner *nlmclnt_find_lockowner(struct nlm_host *host, fl_ow
static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
{
struct nlm_args *argp = &req->a_args;
- struct nlm_lock *lock = &argp->lock;
+ struct lockd_lock *lock = &argp->lock;
char *nodename = req->a_host->h_rpcclnt->cl_nodename;
nlmclnt_next_cookie(&argp->cookie);
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index 2a4d28847254..efa45f12960d 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -60,7 +60,7 @@ static s32 loff_t_to_s32(loff_t offset)
return res;
}
-static void nlm_compute_offsets(const struct nlm_lock *lock,
+static void nlm_compute_offsets(const struct lockd_lock *lock,
u32 *l_offset, u32 *l_len)
{
const struct file_lock *fl = &lock->fl;
@@ -236,7 +236,7 @@ static int decode_nlm_stat(struct xdr_stream *xdr,
static void encode_nlm_holder(struct xdr_stream *xdr,
const struct nlm_res *result)
{
- const struct nlm_lock *lock = &result->lock;
+ const struct lockd_lock *lock = &result->lock;
u32 l_offset, l_len;
__be32 *p;
@@ -252,7 +252,7 @@ static void encode_nlm_holder(struct xdr_stream *xdr,
static int decode_nlm_holder(struct xdr_stream *xdr, struct nlm_res *result)
{
- struct nlm_lock *lock = &result->lock;
+ struct lockd_lock *lock = &result->lock;
struct file_lock *fl = &lock->fl;
u32 exclusive, l_offset, l_len;
int error;
@@ -319,7 +319,7 @@ static void encode_caller_name(struct xdr_stream *xdr, const char *name)
* };
*/
static void encode_nlm_lock(struct xdr_stream *xdr,
- const struct nlm_lock *lock)
+ const struct lockd_lock *lock)
{
u32 l_offset, l_len;
__be32 *p;
@@ -356,7 +356,7 @@ static void nlm_xdr_enc_testargs(struct rpc_rqst *req,
const void *data)
{
const struct nlm_args *args = data;
- const struct nlm_lock *lock = &args->lock;
+ const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
encode_bool(xdr, lock->fl.c.flc_type == F_WRLCK);
@@ -378,7 +378,7 @@ static void nlm_xdr_enc_lockargs(struct rpc_rqst *req,
const void *data)
{
const struct nlm_args *args = data;
- const struct nlm_lock *lock = &args->lock;
+ const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
encode_bool(xdr, args->block);
@@ -401,7 +401,7 @@ static void nlm_xdr_enc_cancargs(struct rpc_rqst *req,
const void *data)
{
const struct nlm_args *args = data;
- const struct nlm_lock *lock = &args->lock;
+ const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
encode_bool(xdr, args->block);
@@ -420,7 +420,7 @@ static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req,
const void *data)
{
const struct nlm_args *args = data;
- const struct nlm_lock *lock = &args->lock;
+ const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
encode_nlm_lock(xdr, lock);
diff --git a/fs/lockd/lockd.h b/fs/lockd/lockd.h
index 119818568507..032790834c7e 100644
--- a/fs/lockd/lockd.h
+++ b/fs/lockd/lockd.h
@@ -253,7 +253,7 @@ void nlmclnt_queue_block(struct nlm_wait *block);
__be32 nlmclnt_dequeue_block(struct nlm_wait *block);
int nlmclnt_wait(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
__be32 nlmclnt_grant(const struct sockaddr *addr,
- const struct nlm_lock *lock);
+ const struct lockd_lock *lock);
void nlmclnt_recovery(struct nlm_host *);
int nlmclnt_reclaim(struct nlm_host *, struct file_lock *,
struct nlm_rqst *);
@@ -313,13 +313,13 @@ typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref);
*/
int lock_to_openmode(struct file_lock *);
__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
- struct nlm_host *, struct nlm_lock *, int,
+ struct nlm_host *, struct lockd_lock *, int,
struct lockd_cookie *, int);
-__be32 nlmsvc_unlock(struct net *net, struct nlm_file *, struct nlm_lock *);
+__be32 nlmsvc_unlock(struct net *net, struct nlm_file *, struct lockd_lock *);
__be32 nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
- struct nlm_host *host, struct nlm_lock *lock,
- struct nlm_lock *conflock);
-__be32 nlmsvc_cancel_blocked(struct net *net, struct nlm_file *, struct nlm_lock *);
+ struct nlm_host *host, struct lockd_lock *lock,
+ struct lockd_lock *conflock);
+__be32 nlmsvc_cancel_blocked(struct net *net, struct nlm_file *, struct lockd_lock *);
void nlmsvc_retry_blocked(struct svc_rqst *rqstp);
void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
nlm_host_match_fn_t match);
@@ -332,10 +332,10 @@ int nlmsvc_dispatch(struct svc_rqst *rqstp);
* File handling for the server personality
*/
__be32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **,
- struct nlm_lock *, int);
+ struct lockd_lock *, int);
void nlm_release_file(struct nlm_file *);
void nlmsvc_put_lockowner(struct nlm_lockowner *);
-void nlmsvc_release_lockowner(struct nlm_lock *);
+void nlmsvc_release_lockowner(struct lockd_lock *);
void nlmsvc_mark_resources(struct net *);
void nlmsvc_free_host_resources(struct nlm_host *);
void nlmsvc_invalidate_all(void);
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index 249ef49f1bcd..f7067fae6c86 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -26,13 +26,13 @@
#include "nlm4xdr_gen.h"
/*
- * Wrapper structures combine xdrgen types with legacy nlm_lock.
+ * Wrapper structures combine xdrgen types with legacy lockd_lock.
* The xdrgen field must be first so the structure can be cast
* to its XDR type for the RPC dispatch layer.
*/
struct nlm4_testargs_wrapper {
struct nlm4_testargs xdrgen;
- struct nlm_lock lock;
+ struct lockd_lock lock;
};
static_assert(offsetof(struct nlm4_testargs_wrapper, xdrgen) == 0);
@@ -40,21 +40,21 @@ static_assert(offsetof(struct nlm4_testargs_wrapper, xdrgen) == 0);
struct nlm4_lockargs_wrapper {
struct nlm4_lockargs xdrgen;
struct lockd_cookie cookie;
- struct nlm_lock lock;
+ struct lockd_lock lock;
};
static_assert(offsetof(struct nlm4_lockargs_wrapper, xdrgen) == 0);
struct nlm4_cancargs_wrapper {
struct nlm4_cancargs xdrgen;
- struct nlm_lock lock;
+ struct lockd_lock lock;
};
static_assert(offsetof(struct nlm4_cancargs_wrapper, xdrgen) == 0);
struct nlm4_unlockargs_wrapper {
struct nlm4_unlockargs xdrgen;
- struct nlm_lock lock;
+ struct lockd_lock lock;
};
static_assert(offsetof(struct nlm4_unlockargs_wrapper, xdrgen) == 0);
@@ -74,12 +74,12 @@ static_assert(offsetof(struct nlm4_notify_wrapper, xdrgen) == 0);
struct nlm4_testres_wrapper {
struct nlm4_testres xdrgen;
- struct nlm_lock lock;
+ struct lockd_lock lock;
};
struct nlm4_shareargs_wrapper {
struct nlm4_shareargs xdrgen;
- struct nlm_lock lock;
+ struct lockd_lock lock;
};
static_assert(offsetof(struct nlm4_shareargs_wrapper, xdrgen) == 0);
@@ -110,7 +110,7 @@ nlm4_netobj_to_cookie(struct lockd_cookie *cookie, netobj *object)
}
static __be32
-nlm4_lock_to_nlm_lock(struct nlm_lock *lock, struct nlm4_lock *alock)
+nlm4_lock_to_lockd_lock(struct lockd_lock *lock, struct nlm4_lock *alock)
{
if (alock->fh.len > NFS_MAXFHSIZE)
return nlm_lck_denied;
@@ -142,7 +142,7 @@ nlm4svc_lookup_host(struct svc_rqst *rqstp, string caller, bool monitored)
static __be32
nlm4svc_lookup_file(struct svc_rqst *rqstp, struct nlm_host *host,
- struct nlm_lock *lock, struct nlm_file **filp,
+ struct lockd_lock *lock, struct nlm_file **filp,
struct nlm4_lock *xdr_lock, unsigned char type)
{
bool is_test = (rqstp->rq_proc == NLMPROC4_TEST ||
@@ -269,7 +269,7 @@ static __be32 nlm4svc_proc_test(struct svc_rqst *rqstp)
nlmsvc_release_lockowner(&argp->lock);
if (resp->xdrgen.stat.stat == nlm_lck_denied) {
- struct nlm_lock *conf = &resp->lock;
+ struct lockd_lock *conf = &resp->lock;
struct nlm4_holder *holder = &resp->xdrgen.stat.u.holder;
holder->exclusive = (conf->fl.c.flc_type != F_RDLCK);
@@ -527,8 +527,8 @@ nlm4svc_proc_granted(struct svc_rqst *rqstp)
resp->xdrgen.cookie = argp->xdrgen.cookie;
- resp->xdrgen.stat.stat = nlm4_lock_to_nlm_lock(&argp->lock,
- &argp->xdrgen.alock);
+ resp->xdrgen.stat.stat = nlm4_lock_to_lockd_lock(&argp->lock,
+ &argp->xdrgen.alock);
if (resp->xdrgen.stat.stat)
goto out;
@@ -842,7 +842,7 @@ __nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_res *resp)
if (nlm4_netobj_to_cookie(&resp->cookie, &argp->xdrgen.cookie))
goto out;
- if (nlm4_lock_to_nlm_lock(&argp->lock, &argp->xdrgen.alock))
+ if (nlm4_lock_to_lockd_lock(&argp->lock, &argp->xdrgen.alock))
goto out;
resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock);
@@ -982,7 +982,7 @@ static __be32 nlm4svc_proc_share(struct svc_rqst *rqstp)
{
struct nlm4_shareargs_wrapper *argp = rqstp->rq_argp;
struct nlm4_shareres_wrapper *resp = rqstp->rq_resp;
- struct nlm_lock *lock = &argp->lock;
+ struct lockd_lock *lock = &argp->lock;
struct nlm_host *host = NULL;
struct nlm_file *file = NULL;
struct nlm4_lock xdr_lock = {
@@ -1050,7 +1050,7 @@ static __be32 nlm4svc_proc_unshare(struct svc_rqst *rqstp)
{
struct nlm4_shareargs_wrapper *argp = rqstp->rq_argp;
struct nlm4_shareres_wrapper *resp = rqstp->rq_resp;
- struct nlm_lock *lock = &argp->lock;
+ struct lockd_lock *lock = &argp->lock;
struct nlm4_lock xdr_lock = {
.fh = argp->xdrgen.share.fh,
.oh = argp->xdrgen.share.oh,
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 7fb03042ebee..e48d31f14a65 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -37,7 +37,7 @@ static void nlmsvc_release_block(struct nlm_block *block);
static void nlmsvc_insert_block(struct nlm_block *block, unsigned long);
static void nlmsvc_remove_block(struct nlm_block *block);
-static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock);
+static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct lockd_lock *lock);
static void nlmsvc_freegrantargs(struct nlm_rqst *call);
static const struct rpc_call_ops nlmsvc_grant_ops;
@@ -142,7 +142,7 @@ nlmsvc_remove_block(struct nlm_block *block)
* Find a block for a given lock
*/
static struct nlm_block *
-nlmsvc_lookup_block(struct nlm_file *file, struct nlm_lock *lock)
+nlmsvc_lookup_block(struct nlm_file *file, struct lockd_lock *lock)
{
struct nlm_block *block;
struct file_lock *fl;
@@ -221,7 +221,7 @@ nlmsvc_find_block(struct lockd_cookie *cookie)
*/
static struct nlm_block *
nlmsvc_create_block(struct svc_rqst *rqstp, struct nlm_host *host,
- struct nlm_file *file, struct nlm_lock *lock,
+ struct nlm_file *file, struct lockd_lock *lock,
struct lockd_cookie *cookie)
{
struct nlm_block *block;
@@ -399,7 +399,7 @@ static struct nlm_lockowner *nlmsvc_find_lockowner(struct nlm_host *host, pid_t
}
void
-nlmsvc_release_lockowner(struct nlm_lock *lock)
+nlmsvc_release_lockowner(struct lockd_lock *lock)
{
if (lock->fl.c.flc_owner)
nlmsvc_put_lockowner(lock->fl.c.flc_owner);
@@ -415,7 +415,7 @@ void nlmsvc_locks_init_private(struct file_lock *fl, struct nlm_host *host,
* Initialize arguments for GRANTED call. The nlm_rqst structure
* has been cleared already.
*/
-static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock)
+static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct lockd_lock *lock)
{
locks_copy_lock(&call->a_args.lock.fl, &lock->fl);
memcpy(&call->a_args.lock.fh, &lock->fh, sizeof(call->a_args.lock.fh));
@@ -476,7 +476,7 @@ nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block)
*/
__be32
nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
- struct nlm_host *host, struct nlm_lock *lock, int wait,
+ struct nlm_host *host, struct lockd_lock *lock, int wait,
struct lockd_cookie *cookie, int reclaim)
{
struct inode *inode __maybe_unused = nlmsvc_file_inode(file);
@@ -609,8 +609,8 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
*/
__be32
nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
- struct nlm_host *host, struct nlm_lock *lock,
- struct nlm_lock *conflock)
+ struct nlm_host *host, struct lockd_lock *lock,
+ struct lockd_lock *conflock)
{
int error;
__be32 ret;
@@ -669,7 +669,7 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
* must be removed.
*/
__be32
-nlmsvc_unlock(struct net *net, struct nlm_file *file, struct nlm_lock *lock)
+nlmsvc_unlock(struct net *net, struct nlm_file *file, struct lockd_lock *lock)
{
int error = 0;
@@ -707,7 +707,7 @@ nlmsvc_unlock(struct net *net, struct nlm_file *file, struct nlm_lock *lock)
* The calling procedure must check whether the file can be closed.
*/
__be32
-nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *lock)
+nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct lockd_lock *lock)
{
struct nlm_block *block;
int status = 0;
@@ -848,7 +848,7 @@ static void
nlmsvc_grant_blocked(struct nlm_block *block)
{
struct nlm_file *file = block->b_file;
- struct nlm_lock *lock = &block->b_call->a_args.lock;
+ struct lockd_lock *lock = &block->b_call->a_args.lock;
int mode;
int error;
loff_t fl_start, fl_end;
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 110e186802b6..2e1dbd4e1df9 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -67,7 +67,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
{
struct nlm_host *host = NULL;
struct nlm_file *file = NULL;
- struct nlm_lock *lock = &argp->lock;
+ struct lockd_lock *lock = &argp->lock;
bool is_test = (rqstp->rq_proc == NLMPROC_TEST ||
rqstp->rq_proc == NLMPROC_TEST_MSG);
int mode;
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index 9da9d6e0b42e..e24bacea7e03 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -132,7 +132,7 @@ static __be32 nlm_do_fopen(struct svc_rqst *rqstp,
*/
__be32
nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
- struct nlm_lock *lock, int mode)
+ struct lockd_lock *lock, int mode)
{
struct nlm_file *file;
unsigned int hash;
diff --git a/fs/lockd/trace.h b/fs/lockd/trace.h
index 7214d7e96a42..aa858d9d406d 100644
--- a/fs/lockd/trace.h
+++ b/fs/lockd/trace.h
@@ -48,7 +48,7 @@ NLM_STATUS_LIST
DECLARE_EVENT_CLASS(nlmclnt_lock_event,
TP_PROTO(
- const struct nlm_lock *lock,
+ const struct lockd_lock *lock,
const struct sockaddr *addr,
unsigned int addrlen,
__be32 status
@@ -87,7 +87,7 @@ DECLARE_EVENT_CLASS(nlmclnt_lock_event,
#define DEFINE_NLMCLNT_EVENT(name) \
DEFINE_EVENT(nlmclnt_lock_event, name, \
TP_PROTO( \
- const struct nlm_lock *lock, \
+ const struct lockd_lock *lock, \
const struct sockaddr *addr, \
unsigned int addrlen, \
__be32 status \
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index dfca8b8dab73..55868222984a 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -69,7 +69,7 @@ svcxdr_decode_fhandle(struct xdr_stream *xdr, struct nfs_fh *fh)
}
static bool
-svcxdr_decode_lock(struct xdr_stream *xdr, struct nlm_lock *lock)
+svcxdr_decode_lock(struct xdr_stream *xdr, struct lockd_lock *lock)
{
struct file_lock *fl = &lock->fl;
s32 start, len, end;
@@ -101,7 +101,7 @@ svcxdr_decode_lock(struct xdr_stream *xdr, struct nlm_lock *lock)
}
static bool
-svcxdr_encode_holder(struct xdr_stream *xdr, const struct nlm_lock *lock)
+svcxdr_encode_holder(struct xdr_stream *xdr, const struct lockd_lock *lock)
{
const struct file_lock *fl = &lock->fl;
s32 start, len;
@@ -271,7 +271,7 @@ bool
nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
struct nlm_args *argp = rqstp->rq_argp;
- struct nlm_lock *lock = &argp->lock;
+ struct lockd_lock *lock = &argp->lock;
memset(lock, 0, sizeof(*lock));
locks_init_lock(&lock->fl);
@@ -298,7 +298,7 @@ bool
nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
struct nlm_args *argp = rqstp->rq_argp;
- struct nlm_lock *lock = &argp->lock;
+ struct lockd_lock *lock = &argp->lock;
if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len))
return false;
diff --git a/fs/lockd/xdr.h b/fs/lockd/xdr.h
index c7e0518862d7..805027d9b0fe 100644
--- a/fs/lockd/xdr.h
+++ b/fs/lockd/xdr.h
@@ -32,7 +32,7 @@ struct svc_rqst;
#define nlm_lck_denied_grace_period cpu_to_be32(NLM_LCK_DENIED_GRACE_PERIOD)
/* Lock info passed via NLM */
-struct nlm_lock {
+struct lockd_lock {
char * caller;
unsigned int len; /* length of "caller" */
struct nfs_fh fh;
@@ -59,7 +59,7 @@ struct lockd_cookie {
*/
struct nlm_args {
struct lockd_cookie cookie;
- struct nlm_lock lock;
+ struct lockd_lock lock;
u32 block;
u32 reclaim;
u32 state;
@@ -74,7 +74,7 @@ struct nlm_args {
struct nlm_res {
struct lockd_cookie cookie;
__be32 status;
- struct nlm_lock lock;
+ struct lockd_lock lock;
};
/*
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 09/38] lockd: Rename struct nlm_args to lockd_args
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (7 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 08/38] lockd: Rename struct nlm_lock to lockd_lock Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 10/38] lockd: Rename struct nlm_res to lockd_res Chuck Lever
` (29 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
As part of the effort to enable lockd's server-side XDR functions to
be generated from the NLM protocol specification (using xdrgen), the
internal type names must be changed to avoid conflicts with the
machine-generated type names.
Rename struct nlm_args to struct lockd_args to avoid conflicts with
the NLMv3 XDR type definitions that will be introduced when
svcproc.c is converted to use xdrgen.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/clnt4xdr.c | 8 +++---
fs/lockd/clntproc.c | 4 +--
fs/lockd/clntxdr.c | 8 +++---
fs/lockd/lockd.h | 2 +-
fs/lockd/svcproc.c | 80 ++++++++++++++++++++++++++---------------------------
fs/lockd/xdr.c | 12 ++++----
fs/lockd/xdr.h | 2 +-
7 files changed, 58 insertions(+), 58 deletions(-)
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index 8973711264cb..d0b08a12fe45 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -354,7 +354,7 @@ static void nlm4_xdr_enc_testargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
- const struct nlm_args *args = data;
+ const struct lockd_args *args = data;
const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
@@ -376,7 +376,7 @@ static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
- const struct nlm_args *args = data;
+ const struct lockd_args *args = data;
const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
@@ -399,7 +399,7 @@ static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
- const struct nlm_args *args = data;
+ const struct lockd_args *args = data;
const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
@@ -418,7 +418,7 @@ static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
- const struct nlm_args *args = data;
+ const struct lockd_args *args = data;
const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index 1aa6597ae0b7..abdf2a51caf2 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -128,7 +128,7 @@ static struct nlm_lockowner *nlmclnt_find_lockowner(struct nlm_host *host, fl_ow
*/
static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
{
- struct nlm_args *argp = &req->a_args;
+ struct lockd_args *argp = &req->a_args;
struct lockd_lock *lock = &argp->lock;
char *nodename = req->a_host->h_rpcclnt->cl_nodename;
@@ -266,7 +266,7 @@ nlmclnt_call(const struct cred *cred, struct nlm_rqst *req, u32 proc)
{
struct nlm_host *host = req->a_host;
struct rpc_clnt *clnt;
- struct nlm_args *argp = &req->a_args;
+ struct lockd_args *argp = &req->a_args;
struct nlm_res *resp = &req->a_res;
struct rpc_message msg = {
.rpc_argp = argp,
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index efa45f12960d..444a34bc799a 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -355,7 +355,7 @@ static void nlm_xdr_enc_testargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
- const struct nlm_args *args = data;
+ const struct lockd_args *args = data;
const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
@@ -377,7 +377,7 @@ static void nlm_xdr_enc_lockargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
- const struct nlm_args *args = data;
+ const struct lockd_args *args = data;
const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
@@ -400,7 +400,7 @@ static void nlm_xdr_enc_cancargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
- const struct nlm_args *args = data;
+ const struct lockd_args *args = data;
const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
@@ -419,7 +419,7 @@ static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
- const struct nlm_args *args = data;
+ const struct lockd_args *args = data;
const struct lockd_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie);
diff --git a/fs/lockd/lockd.h b/fs/lockd/lockd.h
index 032790834c7e..a97676639d3e 100644
--- a/fs/lockd/lockd.h
+++ b/fs/lockd/lockd.h
@@ -171,7 +171,7 @@ struct nlm_rqst {
refcount_t a_count;
unsigned int a_flags; /* initial RPC task flags */
struct nlm_host * a_host; /* host handle */
- struct nlm_args a_args; /* arguments */
+ struct lockd_args a_args; /* arguments */
struct nlm_res a_res; /* result */
struct nlm_block * a_block;
unsigned int a_retries; /* Retry count */
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 2e1dbd4e1df9..8a49b864f6ee 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -62,7 +62,7 @@ static inline __be32 cast_status(__be32 status)
* Obtain client and file from arguments
*/
static __be32
-nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
+nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct lockd_args *argp,
struct nlm_host **hostp, struct nlm_file **filp)
{
struct nlm_host *host = NULL;
@@ -136,7 +136,7 @@ nlmsvc_proc_null(struct svc_rqst *rqstp)
static __be32
__nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
struct nlm_host *host;
struct nlm_file *file;
__be32 rc = rpc_success;
@@ -173,7 +173,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp)
static __be32
__nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
struct nlm_host *host;
struct nlm_file *file;
__be32 rc = rpc_success;
@@ -211,7 +211,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp)
static __be32
__nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
struct nlm_host *host;
struct nlm_file *file;
struct net *net = SVC_NET(rqstp);
@@ -253,7 +253,7 @@ nlmsvc_proc_cancel(struct svc_rqst *rqstp)
static __be32
__nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
struct nlm_host *host;
struct nlm_file *file;
struct net *net = SVC_NET(rqstp);
@@ -296,7 +296,7 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp)
static __be32
__nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_res *resp)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
resp->cookie = argp->cookie;
@@ -345,7 +345,7 @@ static const struct rpc_call_ops nlmsvc_callback_ops = {
static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc,
__be32 (*func)(struct svc_rqst *, struct nlm_res *))
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
struct nlm_host *host;
struct nlm_rqst *call;
__be32 stat;
@@ -411,7 +411,7 @@ nlmsvc_proc_granted_msg(struct svc_rqst *rqstp)
static __be32
nlmsvc_proc_share(struct svc_rqst *rqstp)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
struct nlm_res *resp = rqstp->rq_resp;
struct nlm_host *host;
struct nlm_file *file;
@@ -449,7 +449,7 @@ nlmsvc_proc_share(struct svc_rqst *rqstp)
static __be32
nlmsvc_proc_unshare(struct svc_rqst *rqstp)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
struct nlm_res *resp = rqstp->rq_resp;
struct nlm_host *host;
struct nlm_file *file;
@@ -486,7 +486,7 @@ nlmsvc_proc_unshare(struct svc_rqst *rqstp)
static __be32
nlmsvc_proc_nm_lock(struct svc_rqst *rqstp)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
dprintk("lockd: NM_LOCK called\n");
@@ -500,7 +500,7 @@ nlmsvc_proc_nm_lock(struct svc_rqst *rqstp)
static __be32
nlmsvc_proc_free_all(struct svc_rqst *rqstp)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
struct nlm_host *host;
/* Obtain client */
@@ -582,8 +582,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_test,
.pc_decode = nlmsvc_decode_testargs,
.pc_encode = nlmsvc_encode_testres,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St+2+No+Rg,
.pc_name = "TEST",
@@ -592,8 +592,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_lock,
.pc_decode = nlmsvc_decode_lockargs,
.pc_encode = nlmsvc_encode_res,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St,
.pc_name = "LOCK",
@@ -602,8 +602,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_cancel,
.pc_decode = nlmsvc_decode_cancargs,
.pc_encode = nlmsvc_encode_res,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St,
.pc_name = "CANCEL",
@@ -612,8 +612,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_unlock,
.pc_decode = nlmsvc_decode_unlockargs,
.pc_encode = nlmsvc_encode_res,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St,
.pc_name = "UNLOCK",
@@ -622,8 +622,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_granted,
.pc_decode = nlmsvc_decode_testargs,
.pc_encode = nlmsvc_encode_res,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St,
.pc_name = "GRANTED",
@@ -632,8 +632,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_test_msg,
.pc_decode = nlmsvc_decode_testargs,
.pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St,
.pc_name = "TEST_MSG",
@@ -642,8 +642,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_lock_msg,
.pc_decode = nlmsvc_decode_lockargs,
.pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St,
.pc_name = "LOCK_MSG",
@@ -652,8 +652,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_cancel_msg,
.pc_decode = nlmsvc_decode_cancargs,
.pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St,
.pc_name = "CANCEL_MSG",
@@ -662,8 +662,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_unlock_msg,
.pc_decode = nlmsvc_decode_unlockargs,
.pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St,
.pc_name = "UNLOCK_MSG",
@@ -672,8 +672,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_granted_msg,
.pc_decode = nlmsvc_decode_testargs,
.pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St,
.pc_name = "GRANTED_MSG",
@@ -772,8 +772,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_share,
.pc_decode = nlmsvc_decode_shareargs,
.pc_encode = nlmsvc_encode_shareres,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St+1,
.pc_name = "SHARE",
@@ -782,8 +782,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_unshare,
.pc_decode = nlmsvc_decode_shareargs,
.pc_encode = nlmsvc_encode_shareres,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St+1,
.pc_name = "UNSHARE",
@@ -792,8 +792,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_nm_lock,
.pc_decode = nlmsvc_decode_lockargs,
.pc_encode = nlmsvc_encode_res,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St,
.pc_name = "NM_LOCK",
@@ -802,8 +802,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_free_all,
.pc_decode = nlmsvc_decode_notify,
.pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_args),
- .pc_argzero = sizeof(struct nlm_args),
+ .pc_argsize = sizeof(struct lockd_args),
+ .pc_argzero = sizeof(struct lockd_args),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = 0,
.pc_name = "FREE_ALL",
@@ -814,7 +814,7 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
* Storage requirements for XDR arguments and results
*/
union nlmsvc_xdrstore {
- struct nlm_args args;
+ struct lockd_args args;
struct nlm_res res;
struct nlm_reboot reboot;
};
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index 55868222984a..0130cdea5642 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -154,7 +154,7 @@ nlmsvc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
bool
nlmsvc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
u32 exclusive;
if (!svcxdr_decode_cookie(xdr, &argp->cookie))
@@ -172,7 +172,7 @@ nlmsvc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
bool
nlmsvc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
u32 exclusive;
if (!svcxdr_decode_cookie(xdr, &argp->cookie))
@@ -197,7 +197,7 @@ nlmsvc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
bool
nlmsvc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
u32 exclusive;
if (!svcxdr_decode_cookie(xdr, &argp->cookie))
@@ -217,7 +217,7 @@ nlmsvc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
bool
nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
if (!svcxdr_decode_cookie(xdr, &argp->cookie))
return false;
@@ -270,7 +270,7 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr)
bool
nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
struct lockd_lock *lock = &argp->lock;
memset(lock, 0, sizeof(*lock));
@@ -297,7 +297,7 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
bool
nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct lockd_args *argp = rqstp->rq_argp;
struct lockd_lock *lock = &argp->lock;
if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len))
diff --git a/fs/lockd/xdr.h b/fs/lockd/xdr.h
index 805027d9b0fe..ffdcad0f8680 100644
--- a/fs/lockd/xdr.h
+++ b/fs/lockd/xdr.h
@@ -57,7 +57,7 @@ struct lockd_cookie {
/*
* Generic lockd arguments for all but sm_notify
*/
-struct nlm_args {
+struct lockd_args {
struct lockd_cookie cookie;
struct lockd_lock lock;
u32 block;
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 10/38] lockd: Rename struct nlm_res to lockd_res
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (8 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 09/38] lockd: Rename struct nlm_args to lockd_args Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 11/38] lockd: Rename struct nlm_reboot to lockd_reboot Chuck Lever
` (28 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
As part of the effort to enable lockd's server-side XDR functions to
be generated from the NLM protocol specification (using xdrgen), the
internal type names must be changed to avoid conflicts with the
machine-generated type names.
Rename struct nlm_res to struct lockd_res to avoid conflicts with
the NLMv3 XDR type definitions that will be introduced when svcproc.c
is converted to use xdrgen.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/clnt4xdr.c | 14 +++++++-------
fs/lockd/clntproc.c | 6 +++---
fs/lockd/clntxdr.c | 16 +++++++--------
fs/lockd/lockd.h | 2 +-
fs/lockd/svc4proc.c | 12 ++++++------
fs/lockd/svcproc.c | 56 ++++++++++++++++++++++++++---------------------------
fs/lockd/xdr.c | 10 +++++-----
fs/lockd/xdr.h | 2 +-
8 files changed, 59 insertions(+), 59 deletions(-)
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index d0b08a12fe45..96a4a1e6a6b6 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -238,7 +238,7 @@ static int decode_nlm4_stat(struct xdr_stream *xdr, __be32 *stat)
* };
*/
static void encode_nlm4_holder(struct xdr_stream *xdr,
- const struct nlm_res *result)
+ const struct lockd_res *result)
{
const struct lockd_lock *lock = &result->lock;
u64 l_offset, l_len;
@@ -254,7 +254,7 @@ static void encode_nlm4_holder(struct xdr_stream *xdr,
xdr_encode_hyper(p, l_len);
}
-static int decode_nlm4_holder(struct xdr_stream *xdr, struct nlm_res *result)
+static int decode_nlm4_holder(struct xdr_stream *xdr, struct lockd_res *result)
{
struct lockd_lock *lock = &result->lock;
struct file_lock *fl = &lock->fl;
@@ -435,7 +435,7 @@ static void nlm4_xdr_enc_res(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
- const struct nlm_res *result = data;
+ const struct lockd_res *result = data;
encode_cookie(xdr, &result->cookie);
encode_nlm4_stat(xdr, result->status);
@@ -458,7 +458,7 @@ static void nlm4_xdr_enc_testres(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
- const struct nlm_res *result = data;
+ const struct lockd_res *result = data;
encode_cookie(xdr, &result->cookie);
encode_nlm4_stat(xdr, result->status);
@@ -489,7 +489,7 @@ static void nlm4_xdr_enc_testres(struct rpc_rqst *req,
* };
*/
static int decode_nlm4_testrply(struct xdr_stream *xdr,
- struct nlm_res *result)
+ struct lockd_res *result)
{
int error;
@@ -506,7 +506,7 @@ static int nlm4_xdr_dec_testres(struct rpc_rqst *req,
struct xdr_stream *xdr,
void *data)
{
- struct nlm_res *result = data;
+ struct lockd_res *result = data;
int error;
error = decode_cookie(xdr, &result->cookie);
@@ -527,7 +527,7 @@ static int nlm4_xdr_dec_res(struct rpc_rqst *req,
struct xdr_stream *xdr,
void *data)
{
- struct nlm_res *result = data;
+ struct lockd_res *result = data;
int error;
error = decode_cookie(xdr, &result->cookie);
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index abdf2a51caf2..f06faf577cea 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -267,7 +267,7 @@ nlmclnt_call(const struct cred *cred, struct nlm_rqst *req, u32 proc)
struct nlm_host *host = req->a_host;
struct rpc_clnt *clnt;
struct lockd_args *argp = &req->a_args;
- struct nlm_res *resp = &req->a_res;
+ struct lockd_res *resp = &req->a_res;
struct rpc_message msg = {
.rpc_argp = argp,
.rpc_resp = resp,
@@ -523,7 +523,7 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
{
const struct cred *cred = nfs_file_cred(fl->c.flc_file);
struct nlm_host *host = req->a_host;
- struct nlm_res *resp = &req->a_res;
+ struct lockd_res *resp = &req->a_res;
struct nlm_wait block;
unsigned char flags = fl->c.flc_flags;
unsigned char type;
@@ -686,7 +686,7 @@ static int
nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
{
struct nlm_host *host = req->a_host;
- struct nlm_res *resp = &req->a_res;
+ struct lockd_res *resp = &req->a_res;
int status;
unsigned char flags = fl->c.flc_flags;
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index 444a34bc799a..3789ecb0b984 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -234,7 +234,7 @@ static int decode_nlm_stat(struct xdr_stream *xdr,
* };
*/
static void encode_nlm_holder(struct xdr_stream *xdr,
- const struct nlm_res *result)
+ const struct lockd_res *result)
{
const struct lockd_lock *lock = &result->lock;
u32 l_offset, l_len;
@@ -250,7 +250,7 @@ static void encode_nlm_holder(struct xdr_stream *xdr,
*p = cpu_to_be32(l_len);
}
-static int decode_nlm_holder(struct xdr_stream *xdr, struct nlm_res *result)
+static int decode_nlm_holder(struct xdr_stream *xdr, struct lockd_res *result)
{
struct lockd_lock *lock = &result->lock;
struct file_lock *fl = &lock->fl;
@@ -436,7 +436,7 @@ static void nlm_xdr_enc_res(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
- const struct nlm_res *result = data;
+ const struct lockd_res *result = data;
encode_cookie(xdr, &result->cookie);
encode_nlm_stat(xdr, result->status);
@@ -456,7 +456,7 @@ static void nlm_xdr_enc_res(struct rpc_rqst *req,
* };
*/
static void encode_nlm_testrply(struct xdr_stream *xdr,
- const struct nlm_res *result)
+ const struct lockd_res *result)
{
if (result->status == nlm_lck_denied)
encode_nlm_holder(xdr, result);
@@ -466,7 +466,7 @@ static void nlm_xdr_enc_testres(struct rpc_rqst *req,
struct xdr_stream *xdr,
const void *data)
{
- const struct nlm_res *result = data;
+ const struct lockd_res *result = data;
encode_cookie(xdr, &result->cookie);
encode_nlm_stat(xdr, result->status);
@@ -495,7 +495,7 @@ static void nlm_xdr_enc_testres(struct rpc_rqst *req,
* };
*/
static int decode_nlm_testrply(struct xdr_stream *xdr,
- struct nlm_res *result)
+ struct lockd_res *result)
{
int error;
@@ -512,7 +512,7 @@ static int nlm_xdr_dec_testres(struct rpc_rqst *req,
struct xdr_stream *xdr,
void *data)
{
- struct nlm_res *result = data;
+ struct lockd_res *result = data;
int error;
error = decode_cookie(xdr, &result->cookie);
@@ -533,7 +533,7 @@ static int nlm_xdr_dec_res(struct rpc_rqst *req,
struct xdr_stream *xdr,
void *data)
{
- struct nlm_res *result = data;
+ struct lockd_res *result = data;
int error;
error = decode_cookie(xdr, &result->cookie);
diff --git a/fs/lockd/lockd.h b/fs/lockd/lockd.h
index a97676639d3e..4054e97723d8 100644
--- a/fs/lockd/lockd.h
+++ b/fs/lockd/lockd.h
@@ -172,7 +172,7 @@ struct nlm_rqst {
unsigned int a_flags; /* initial RPC task flags */
struct nlm_host * a_host; /* host handle */
struct lockd_args a_args; /* arguments */
- struct nlm_res a_res; /* result */
+ struct lockd_res a_res; /* result */
struct nlm_block * a_block;
unsigned int a_retries; /* Retry count */
u8 a_owner[NLMCLNT_OHSIZE];
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index f7067fae6c86..1682a7c91a78 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -562,7 +562,7 @@ static const struct rpc_call_ops nlm4svc_callback_ops = {
*/
static __be32
nlm4svc_callback(struct svc_rqst *rqstp, struct nlm_host *host, u32 proc,
- __be32 (*func)(struct svc_rqst *, struct nlm_res *))
+ __be32 (*func)(struct svc_rqst *, struct lockd_res *))
{
struct nlm_rqst *call;
__be32 stat;
@@ -585,7 +585,7 @@ nlm4svc_callback(struct svc_rqst *rqstp, struct nlm_host *host, u32 proc,
}
static __be32
-__nlm4svc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_res *resp)
+__nlm4svc_proc_test_msg(struct svc_rqst *rqstp, struct lockd_res *resp)
{
struct nlm4_testargs_wrapper *argp = rqstp->rq_argp;
unsigned char type = argp->xdrgen.exclusive ? F_WRLCK : F_RDLCK;
@@ -645,7 +645,7 @@ static __be32 nlm4svc_proc_test_msg(struct svc_rqst *rqstp)
}
static __be32
-__nlm4svc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_res *resp)
+__nlm4svc_proc_lock_msg(struct svc_rqst *rqstp, struct lockd_res *resp)
{
struct nlm4_lockargs_wrapper *argp = rqstp->rq_argp;
unsigned char type = argp->xdrgen.exclusive ? F_WRLCK : F_RDLCK;
@@ -707,7 +707,7 @@ static __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp)
}
static __be32
-__nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_res *resp)
+__nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp, struct lockd_res *resp)
{
struct nlm4_cancargs_wrapper *argp = rqstp->rq_argp;
unsigned char type = argp->xdrgen.exclusive ? F_WRLCK : F_RDLCK;
@@ -771,7 +771,7 @@ static __be32 nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp)
}
static __be32
-__nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_res *resp)
+__nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp, struct lockd_res *resp)
{
struct nlm4_unlockargs_wrapper *argp = rqstp->rq_argp;
struct net *net = SVC_NET(rqstp);
@@ -834,7 +834,7 @@ static __be32 nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp)
}
static __be32
-__nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_res *resp)
+__nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct lockd_res *resp)
{
struct nlm4_testargs_wrapper *argp = rqstp->rq_argp;
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 8a49b864f6ee..e033320b840f 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -134,7 +134,7 @@ nlmsvc_proc_null(struct svc_rqst *rqstp)
* TEST: Check for conflicting lock
*/
static __be32
-__nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
+__nlmsvc_proc_test(struct svc_rqst *rqstp, struct lockd_res *resp)
{
struct lockd_args *argp = rqstp->rq_argp;
struct nlm_host *host;
@@ -171,7 +171,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp)
}
static __be32
-__nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
+__nlmsvc_proc_lock(struct svc_rqst *rqstp, struct lockd_res *resp)
{
struct lockd_args *argp = rqstp->rq_argp;
struct nlm_host *host;
@@ -209,7 +209,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp)
}
static __be32
-__nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
+__nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct lockd_res *resp)
{
struct lockd_args *argp = rqstp->rq_argp;
struct nlm_host *host;
@@ -251,7 +251,7 @@ nlmsvc_proc_cancel(struct svc_rqst *rqstp)
* UNLOCK: release a lock
*/
static __be32
-__nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
+__nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct lockd_res *resp)
{
struct lockd_args *argp = rqstp->rq_argp;
struct nlm_host *host;
@@ -294,7 +294,7 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp)
* was granted
*/
static __be32
-__nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_res *resp)
+__nlmsvc_proc_granted(struct svc_rqst *rqstp, struct lockd_res *resp)
{
struct lockd_args *argp = rqstp->rq_argp;
@@ -343,7 +343,7 @@ static const struct rpc_call_ops nlmsvc_callback_ops = {
* doesn't break any clients.
*/
static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc,
- __be32 (*func)(struct svc_rqst *, struct nlm_res *))
+ __be32 (*func)(struct svc_rqst *, struct lockd_res *))
{
struct lockd_args *argp = rqstp->rq_argp;
struct nlm_host *host;
@@ -412,7 +412,7 @@ static __be32
nlmsvc_proc_share(struct svc_rqst *rqstp)
{
struct lockd_args *argp = rqstp->rq_argp;
- struct nlm_res *resp = rqstp->rq_resp;
+ struct lockd_res *resp = rqstp->rq_resp;
struct nlm_host *host;
struct nlm_file *file;
@@ -450,7 +450,7 @@ static __be32
nlmsvc_proc_unshare(struct svc_rqst *rqstp)
{
struct lockd_args *argp = rqstp->rq_argp;
- struct nlm_res *resp = rqstp->rq_resp;
+ struct lockd_res *resp = rqstp->rq_resp;
struct nlm_host *host;
struct nlm_file *file;
@@ -539,7 +539,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp)
static __be32
nlmsvc_proc_granted_res(struct svc_rqst *rqstp)
{
- struct nlm_res *argp = rqstp->rq_argp;
+ struct lockd_res *argp = rqstp->rq_argp;
if (!nlmsvc_ops)
return rpc_success;
@@ -584,7 +584,7 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_encode = nlmsvc_encode_testres,
.pc_argsize = sizeof(struct lockd_args),
.pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct lockd_res),
.pc_xdrressize = Ck+St+2+No+Rg,
.pc_name = "TEST",
},
@@ -594,7 +594,7 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_encode = nlmsvc_encode_res,
.pc_argsize = sizeof(struct lockd_args),
.pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct lockd_res),
.pc_xdrressize = Ck+St,
.pc_name = "LOCK",
},
@@ -604,7 +604,7 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_encode = nlmsvc_encode_res,
.pc_argsize = sizeof(struct lockd_args),
.pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct lockd_res),
.pc_xdrressize = Ck+St,
.pc_name = "CANCEL",
},
@@ -614,7 +614,7 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_encode = nlmsvc_encode_res,
.pc_argsize = sizeof(struct lockd_args),
.pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct lockd_res),
.pc_xdrressize = Ck+St,
.pc_name = "UNLOCK",
},
@@ -624,7 +624,7 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_encode = nlmsvc_encode_res,
.pc_argsize = sizeof(struct lockd_args),
.pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct lockd_res),
.pc_xdrressize = Ck+St,
.pc_name = "GRANTED",
},
@@ -682,8 +682,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_null,
.pc_decode = nlmsvc_decode_void,
.pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_res),
- .pc_argzero = sizeof(struct nlm_res),
+ .pc_argsize = sizeof(struct lockd_res),
+ .pc_argzero = sizeof(struct lockd_res),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St,
.pc_name = "TEST_RES",
@@ -692,8 +692,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_null,
.pc_decode = nlmsvc_decode_void,
.pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_res),
- .pc_argzero = sizeof(struct nlm_res),
+ .pc_argsize = sizeof(struct lockd_res),
+ .pc_argzero = sizeof(struct lockd_res),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St,
.pc_name = "LOCK_RES",
@@ -702,8 +702,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_null,
.pc_decode = nlmsvc_decode_void,
.pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_res),
- .pc_argzero = sizeof(struct nlm_res),
+ .pc_argsize = sizeof(struct lockd_res),
+ .pc_argzero = sizeof(struct lockd_res),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St,
.pc_name = "CANCEL_RES",
@@ -712,8 +712,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_null,
.pc_decode = nlmsvc_decode_void,
.pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_res),
- .pc_argzero = sizeof(struct nlm_res),
+ .pc_argsize = sizeof(struct lockd_res),
+ .pc_argzero = sizeof(struct lockd_res),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St,
.pc_name = "UNLOCK_RES",
@@ -722,8 +722,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_granted_res,
.pc_decode = nlmsvc_decode_res,
.pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_res),
- .pc_argzero = sizeof(struct nlm_res),
+ .pc_argsize = sizeof(struct lockd_res),
+ .pc_argzero = sizeof(struct lockd_res),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St,
.pc_name = "GRANTED_RES",
@@ -774,7 +774,7 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_encode = nlmsvc_encode_shareres,
.pc_argsize = sizeof(struct lockd_args),
.pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct lockd_res),
.pc_xdrressize = Ck+St+1,
.pc_name = "SHARE",
},
@@ -784,7 +784,7 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_encode = nlmsvc_encode_shareres,
.pc_argsize = sizeof(struct lockd_args),
.pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct lockd_res),
.pc_xdrressize = Ck+St+1,
.pc_name = "UNSHARE",
},
@@ -794,7 +794,7 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_encode = nlmsvc_encode_res,
.pc_argsize = sizeof(struct lockd_args),
.pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct lockd_res),
.pc_xdrressize = Ck+St,
.pc_name = "NM_LOCK",
},
@@ -815,7 +815,7 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
*/
union nlmsvc_xdrstore {
struct lockd_args args;
- struct nlm_res res;
+ struct lockd_res res;
struct nlm_reboot reboot;
};
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index 0130cdea5642..bcf65152a436 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -127,7 +127,7 @@ svcxdr_encode_holder(struct xdr_stream *xdr, const struct lockd_lock *lock)
}
static bool
-svcxdr_encode_testrply(struct xdr_stream *xdr, const struct nlm_res *resp)
+svcxdr_encode_testrply(struct xdr_stream *xdr, const struct lockd_res *resp)
{
if (!svcxdr_encode_stats(xdr, resp->status))
return false;
@@ -231,7 +231,7 @@ nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
bool
nlmsvc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
- struct nlm_res *resp = rqstp->rq_argp;
+ struct lockd_res *resp = rqstp->rq_argp;
if (!svcxdr_decode_cookie(xdr, &resp->cookie))
return false;
@@ -322,7 +322,7 @@ nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
bool
nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
- struct nlm_res *resp = rqstp->rq_resp;
+ struct lockd_res *resp = rqstp->rq_resp;
return svcxdr_encode_cookie(xdr, &resp->cookie) &&
svcxdr_encode_testrply(xdr, resp);
@@ -331,7 +331,7 @@ nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
bool
nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
- struct nlm_res *resp = rqstp->rq_resp;
+ struct lockd_res *resp = rqstp->rq_resp;
return svcxdr_encode_cookie(xdr, &resp->cookie) &&
svcxdr_encode_stats(xdr, resp->status);
@@ -340,7 +340,7 @@ nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
bool
nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
- struct nlm_res *resp = rqstp->rq_resp;
+ struct lockd_res *resp = rqstp->rq_resp;
if (!svcxdr_encode_cookie(xdr, &resp->cookie))
return false;
diff --git a/fs/lockd/xdr.h b/fs/lockd/xdr.h
index ffdcad0f8680..a480df7cae31 100644
--- a/fs/lockd/xdr.h
+++ b/fs/lockd/xdr.h
@@ -71,7 +71,7 @@ struct lockd_args {
/*
* Generic lockd result
*/
-struct nlm_res {
+struct lockd_res {
struct lockd_cookie cookie;
__be32 status;
struct lockd_lock lock;
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 11/38] lockd: Rename struct nlm_reboot to lockd_reboot
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (9 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 10/38] lockd: Rename struct nlm_res to lockd_res Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 12/38] lockd: Rename struct nlm_share to lockd_share Chuck Lever
` (27 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
As part of the effort to enable lockd's server-side XDR functions to
be generated from the NLM protocol specification (using xdrgen), the
internal type names must be changed to avoid conflicts with the
machine-generated type names.
Rename struct nlm_reboot to struct lockd_reboot for consistency with
the other renamed internal types.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/host.c | 4 ++--
fs/lockd/lockd.h | 4 ++--
fs/lockd/mon.c | 2 +-
fs/lockd/svc4proc.c | 4 ++--
fs/lockd/svcproc.c | 8 ++++----
fs/lockd/xdr.c | 2 +-
fs/lockd/xdr.h | 2 +-
7 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index ea8a8e166f7e..d572cb27533f 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -552,7 +552,7 @@ struct nlm_host * nlm_get_host(struct nlm_host *host)
static struct nlm_host *next_host_state(struct hlist_head *cache,
struct nsm_handle *nsm,
- const struct nlm_reboot *info)
+ const struct lockd_reboot *info)
{
struct nlm_host *host;
struct hlist_head *chain;
@@ -582,7 +582,7 @@ static struct nlm_host *next_host_state(struct hlist_head *cache,
* We were notified that the specified host has rebooted. Release
* all resources held by that peer.
*/
-void nlm_host_rebooted(const struct net *net, const struct nlm_reboot *info)
+void nlm_host_rebooted(const struct net *net, const struct lockd_reboot *info)
{
struct nsm_handle *nsm;
struct nlm_host *host;
diff --git a/fs/lockd/lockd.h b/fs/lockd/lockd.h
index 4054e97723d8..ca389525a170 100644
--- a/fs/lockd/lockd.h
+++ b/fs/lockd/lockd.h
@@ -285,7 +285,7 @@ struct nlm_host * nlm_get_host(struct nlm_host *);
void nlm_shutdown_hosts(void);
void nlm_shutdown_hosts_net(struct net *net);
void nlm_host_rebooted(const struct net *net,
- const struct nlm_reboot *);
+ const struct lockd_reboot *);
/*
* Host monitoring
@@ -299,7 +299,7 @@ struct nsm_handle *nsm_get_handle(const struct net *net,
const char *hostname,
const size_t hostname_len);
struct nsm_handle *nsm_reboot_lookup(const struct net *net,
- const struct nlm_reboot *info);
+ const struct lockd_reboot *info);
void nsm_release(struct nsm_handle *nsm);
/*
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index 3d3ee88ca4dc..a8f5ac6f0577 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -377,7 +377,7 @@ struct nsm_handle *nsm_get_handle(const struct net *net,
* error occurred.
*/
struct nsm_handle *nsm_reboot_lookup(const struct net *net,
- const struct nlm_reboot *info)
+ const struct lockd_reboot *info)
{
struct nsm_handle *cached;
struct lockd_net *ln = net_generic(net, lockd_net_id);
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index 1682a7c91a78..997f4f437997 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -61,7 +61,7 @@ static_assert(offsetof(struct nlm4_unlockargs_wrapper, xdrgen) == 0);
struct nlm4_notifyargs_wrapper {
struct nlm4_notifyargs xdrgen;
- struct nlm_reboot reboot;
+ struct lockd_reboot reboot;
};
static_assert(offsetof(struct nlm4_notifyargs_wrapper, xdrgen) == 0);
@@ -918,7 +918,7 @@ static __be32 nlm4svc_proc_granted_res(struct svc_rqst *rqstp)
static __be32 nlm4svc_proc_sm_notify(struct svc_rqst *rqstp)
{
struct nlm4_notifyargs_wrapper *argp = rqstp->rq_argp;
- struct nlm_reboot *reboot = &argp->reboot;
+ struct lockd_reboot *reboot = &argp->reboot;
if (!nlm_privileged_requester(rqstp)) {
char buf[RPC_MAX_ADDRBUFLEN];
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index e033320b840f..a79c9a46db60 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -518,7 +518,7 @@ nlmsvc_proc_free_all(struct svc_rqst *rqstp)
static __be32
nlmsvc_proc_sm_notify(struct svc_rqst *rqstp)
{
- struct nlm_reboot *argp = rqstp->rq_argp;
+ struct lockd_reboot *argp = rqstp->rq_argp;
dprintk("lockd: SM_NOTIFY called\n");
@@ -732,8 +732,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_func = nlmsvc_proc_sm_notify,
.pc_decode = nlmsvc_decode_reboot,
.pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_reboot),
- .pc_argzero = sizeof(struct nlm_reboot),
+ .pc_argsize = sizeof(struct lockd_reboot),
+ .pc_argzero = sizeof(struct lockd_reboot),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St,
.pc_name = "SM_NOTIFY",
@@ -816,7 +816,7 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
union nlmsvc_xdrstore {
struct lockd_args args;
struct lockd_res res;
- struct nlm_reboot reboot;
+ struct lockd_reboot reboot;
};
/*
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index bcf65152a436..c78c64557fea 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -244,7 +244,7 @@ nlmsvc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
bool
nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
- struct nlm_reboot *argp = rqstp->rq_argp;
+ struct lockd_reboot *argp = rqstp->rq_argp;
__be32 *p;
u32 len;
diff --git a/fs/lockd/xdr.h b/fs/lockd/xdr.h
index a480df7cae31..65d2d6d34310 100644
--- a/fs/lockd/xdr.h
+++ b/fs/lockd/xdr.h
@@ -80,7 +80,7 @@ struct lockd_res {
/*
* statd callback when client has rebooted
*/
-struct nlm_reboot {
+struct lockd_reboot {
char *mon;
unsigned int len;
u32 state;
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 12/38] lockd: Rename struct nlm_share to lockd_share
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (10 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 11/38] lockd: Rename struct nlm_reboot to lockd_reboot Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 13/38] lockd: Use xdrgen XDR functions for the NLMv3 NULL procedure Chuck Lever
` (26 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
As part of the effort to enable lockd's server-side XDR functions to
be generated from the NLM protocol specification (using xdrgen), the
internal type names must be changed to avoid conflicts with the
machine-generated type names.
Rename struct nlm_share to struct lockd_share to avoid conflicts with
the NLMv3 XDR type definitions that will be introduced when svcproc.c
is converted to use xdrgen.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/lockd.h | 4 ++--
fs/lockd/share.h | 4 ++--
fs/lockd/svcshare.c | 8 ++++----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/lockd/lockd.h b/fs/lockd/lockd.h
index ca389525a170..5c79681b7e95 100644
--- a/fs/lockd/lockd.h
+++ b/fs/lockd/lockd.h
@@ -179,7 +179,7 @@ struct nlm_rqst {
void * a_callback_data; /* sent to nlmclnt_operations callbacks */
};
-struct nlm_share;
+struct lockd_share;
/*
* This struct describes a file held open by lockd on behalf of
@@ -190,7 +190,7 @@ struct nlm_file {
struct nfs_fh f_handle; /* NFS file handle */
struct file * f_file[2]; /* VFS file pointers,
indexed by O_ flags */
- struct nlm_share * f_shares; /* DOS shares */
+ struct lockd_share * f_shares; /* DOS shares */
struct list_head f_blocks; /* blocked locks */
unsigned int f_locks; /* guesstimate # of locks */
unsigned int f_count; /* reference count */
diff --git a/fs/lockd/share.h b/fs/lockd/share.h
index 20ea8ee49168..1ec3ccdb2aef 100644
--- a/fs/lockd/share.h
+++ b/fs/lockd/share.h
@@ -14,8 +14,8 @@
/*
* DOS share for a specific file
*/
-struct nlm_share {
- struct nlm_share * s_next; /* linked list */
+struct lockd_share {
+ struct lockd_share * s_next; /* linked list */
struct nlm_host * s_host; /* client host */
struct nlm_file * s_file; /* shared file */
struct xdr_netobj s_owner; /* owner handle */
diff --git a/fs/lockd/svcshare.c b/fs/lockd/svcshare.c
index 53f5655c128c..5ac0ec25d62d 100644
--- a/fs/lockd/svcshare.c
+++ b/fs/lockd/svcshare.c
@@ -19,7 +19,7 @@
#include "share.h"
static inline int
-nlm_cmp_owner(struct nlm_share *share, struct xdr_netobj *oh)
+nlm_cmp_owner(struct lockd_share *share, struct xdr_netobj *oh)
{
return share->s_owner.len == oh->len
&& !memcmp(share->s_owner.data, oh->data, oh->len);
@@ -39,7 +39,7 @@ __be32
nlmsvc_share_file(struct nlm_host *host, struct nlm_file *file,
struct xdr_netobj *oh, u32 access, u32 mode)
{
- struct nlm_share *share;
+ struct lockd_share *share;
u8 *ohdata;
if (nlmsvc_file_cannot_lock(file))
@@ -85,7 +85,7 @@ __be32
nlmsvc_unshare_file(struct nlm_host *host, struct nlm_file *file,
struct xdr_netobj *oh)
{
- struct nlm_share *share, **shpp;
+ struct lockd_share *share, **shpp;
if (nlmsvc_file_cannot_lock(file))
return nlm_lck_denied_nolocks;
@@ -111,7 +111,7 @@ nlmsvc_unshare_file(struct nlm_host *host, struct nlm_file *file,
void nlmsvc_traverse_shares(struct nlm_host *host, struct nlm_file *file,
nlm_host_match_fn_t match)
{
- struct nlm_share *share, **shpp;
+ struct lockd_share *share, **shpp;
shpp = &file->f_shares;
while ((share = *shpp) != NULL) {
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 13/38] lockd: Use xdrgen XDR functions for the NLMv3 NULL procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (11 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 12/38] lockd: Rename struct nlm_share to lockd_share Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 14/38] lockd: Use xdrgen XDR functions for the NLMv3 TEST procedure Chuck Lever
` (25 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Hand-written XDR encoders and decoders are difficult to maintain
and can diverge from protocol specifications. Migrating to
xdrgen-generated code improves type safety and ensures the
implementation matches the NLM version 3 protocol specification
exactly.
Convert the NULL procedure to use nlm_svc_decode_void and
nlm_svc_encode_void, generated from
Documentation/sunrpc/xdr/nlm3.x. NULL has no arguments or
results, so it is the first procedure converted.
NULL returns no XDR-encoded data, so pc_xdrressize is set to
XDR_void. The argzero field is also set to zero since xdrgen
decoders initialize all decoded values.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 42 ++++++++++++++++++++++++++++--------------
1 file changed, 28 insertions(+), 14 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index a79c9a46db60..ad37f3611eea 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -13,7 +13,16 @@
#include <linux/sunrpc/svc_xprt.h>
#include "lockd.h"
+
+/*
+ * xdr.h defines SM_PRIV_SIZE as a macro. nlm3xdr_gen.h defines
+ * it as an enum constant. Undefine the macro before including
+ * the generated header.
+ */
+#undef SM_PRIV_SIZE
+
#include "share.h"
+#include "nlm3xdr_gen.h"
#define NLMDBG_FACILITY NLMDBG_CLIENT
@@ -120,13 +129,18 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct lockd_args *argp,
return nlm_lck_denied_nolocks;
}
-/*
- * NULL: Test for presence of service
+/**
+ * nlmsvc_proc_null - NULL: Test for presence of service
+ * @rqstp: RPC transaction context
+ *
+ * Return:
+ * %rpc_success: RPC executed successfully
+ *
+ * RPC synopsis:
+ * void NLM_NULL(void) = 0;
*/
-static __be32
-nlmsvc_proc_null(struct svc_rqst *rqstp)
+static __be32 nlmsvc_proc_null(struct svc_rqst *rqstp)
{
- dprintk("lockd: NULL called\n");
return rpc_success;
}
@@ -568,15 +582,15 @@ struct nlm_void { int dummy; };
#define Rg 2 /* range - offset + size */
static const struct svc_procedure nlmsvc_procedures[24] = {
- [NLMPROC_NULL] = {
- .pc_func = nlmsvc_proc_null,
- .pc_decode = nlmsvc_decode_void,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_void),
- .pc_argzero = sizeof(struct nlm_void),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "NULL",
+ [NLM_NULL] = {
+ .pc_func = nlmsvc_proc_null,
+ .pc_decode = nlm_svc_decode_void,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = XDR_void,
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "NULL",
},
[NLMPROC_TEST] = {
.pc_func = nlmsvc_proc_test,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 14/38] lockd: Use xdrgen XDR functions for the NLMv3 TEST procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (12 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 13/38] lockd: Use xdrgen XDR functions for the NLMv3 NULL procedure Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 15/38] lockd: Use xdrgen XDR functions for the NLMv3 LOCK procedure Chuck Lever
` (24 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
The NLM TEST procedure requires host and file lookups to check
lock state, operations that will be common across multiple NLM
procedures being migrated to xdrgen. Introducing the
nlm3svc_lookup_host() and nlm3svc_lookup_file() helpers now keeps
these common patterns in one place for subsequent conversions in
this series.
This patch converts the TEST procedure to use xdrgen functions
nlm_svc_decode_nlm_testargs and nlm_svc_encode_nlm_testres
generated from the NLM version 3 protocol specification. The
procedure handler is rewritten to use xdrgen types through wrapper
structures that bridge between generated code and the legacy
lockd_lock representation still used by the core lockd logic.
Setting pc_argzero to zero is safe because the generated decoder
fills the argp->xdrgen subfields before the procedure runs, so the
zeroing memset performed by the dispatch layer is not needed. The
lock member of the wrapper is populated explicitly in
nlm3svc_lookup_file() rather than relying on zero-initialization.
The conflicting holder's offset and length are saturated to
NLM_OFFSET_MAX when constructing the reply. A conflicting lock
established by an NLMv4 client or by a local process can sit
beyond the NLMv3 signed 32-bit range, and copying fl_start and
fl_end straight into the unsigned 32-bit XDR fields would wrap
and report a bogus range. The previous hand-written encoder in
svcxdr_encode_holder() used loff_t_to_s32() for the same reason,
but this patch series intends to separate the concerns of data
conversion (XDR) from dealing with local byte range constraints,
so clamping is hoisted into the proc function.
The previous hand-written decoder in svcxdr_decode_cookie()
rewrote a zero-length NLM cookie into a four-byte zero cookie,
with a comment attributing the substitution to HP-UX clients.
The xdrgen-generated netobj decoder performs no such rewrite, so
a zero-length request cookie now round-trips unchanged into the
reply. HP-UX has reached end of support, and NLM_TEST reply
matching relies on the RPC XID rather than the NLM cookie, so
the workaround is dropped intentionally here.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/lockd.h | 23 +++++++
fs/lockd/svcproc.c | 195 +++++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 206 insertions(+), 12 deletions(-)
diff --git a/fs/lockd/lockd.h b/fs/lockd/lockd.h
index 5c79681b7e95..0be0dac59ea2 100644
--- a/fs/lockd/lockd.h
+++ b/fs/lockd/lockd.h
@@ -422,6 +422,29 @@ static inline int nlm_compare_locks(const struct file_lock *fl1,
&&(fl1->c.flc_type == fl2->c.flc_type || fl2->c.flc_type == F_UNLCK);
}
+/**
+ * lockd_set_file_lock_range3 - set the byte range of a file_lock
+ * @fl: file_lock whose length fields are to be initialized
+ * @off: starting offset of the lock, in bytes
+ * @len: length of the byte range, in bytes, or zero
+ *
+ * NLMv3 uses a (start, length) representation for lock byte ranges,
+ * while the kernel's file_lock uses (start, end). Treat a length of
+ * zero or arithmetic overflow (end wrapping negative when the sum
+ * exceeds S32_MAX) as "lock to end of file."
+ */
+static inline void
+lockd_set_file_lock_range3(struct file_lock *fl, u32 off, u32 len)
+{
+ s32 end = off + len - 1;
+
+ fl->fl_start = off;
+ if (len == 0 || end < 0)
+ fl->fl_end = OFFSET_MAX;
+ else
+ fl->fl_end = end;
+}
+
/**
* lockd_set_file_lock_range4 - set the byte range of a file_lock
* @fl: file_lock whose length fields are to be initialized
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index ad37f3611eea..7794e6f88a71 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -26,6 +26,106 @@
#define NLMDBG_FACILITY NLMDBG_CLIENT
+/*
+ * Size of an NFSv2 file handle, in bytes, which is 32.
+ * Defined locally to avoid including uapi/linux/nfs2.h.
+ */
+#define NLM3_FHSIZE 32
+
+/*
+ * Wrapper structures combine xdrgen types with legacy lockd_lock.
+ * The xdrgen field must be first so the structure can be cast
+ * to its XDR type for the RPC dispatch layer.
+ */
+struct nlm_testargs_wrapper {
+ struct nlm_testargs xdrgen;
+ struct lockd_lock lock;
+};
+
+static_assert(offsetof(struct nlm_testargs_wrapper, xdrgen) == 0);
+
+struct nlm_testres_wrapper {
+ struct nlm_testres xdrgen;
+ struct lockd_lock lock;
+};
+
+static_assert(offsetof(struct nlm_testres_wrapper, xdrgen) == 0);
+
+static struct nlm_host *
+nlm3svc_lookup_host(struct svc_rqst *rqstp, string caller, bool monitored)
+{
+ struct nlm_host *host;
+
+ if (!nlmsvc_ops)
+ return NULL;
+ host = nlmsvc_lookup_host(rqstp, caller.data, caller.len);
+ if (!host)
+ return NULL;
+ if (monitored && nsm_monitor(host) < 0) {
+ nlmsvc_release_host(host);
+ return NULL;
+ }
+ return host;
+}
+
+static __be32
+nlm3svc_lookup_file(struct svc_rqst *rqstp, struct nlm_host *host,
+ struct lockd_lock *lock, struct nlm_file **filp,
+ struct nlm_lock *xdr_lock, unsigned char type)
+{
+ bool is_test = (rqstp->rq_proc == NLMPROC_TEST ||
+ rqstp->rq_proc == NLMPROC_TEST_MSG);
+ struct file_lock *fl = &lock->fl;
+ struct nlm_file *file = NULL;
+ __be32 error;
+ int mode;
+
+ if (xdr_lock->fh.len != NLM3_FHSIZE)
+ return nlm_lck_denied_nolocks;
+ lock->fh.size = xdr_lock->fh.len;
+ memcpy(lock->fh.data, xdr_lock->fh.data, xdr_lock->fh.len);
+
+ lock->oh.len = xdr_lock->oh.len;
+ lock->oh.data = xdr_lock->oh.data;
+
+ lock->svid = xdr_lock->uppid;
+ lock->lock_start = xdr_lock->l_offset;
+ lock->lock_len = xdr_lock->l_len;
+
+ locks_init_lock(fl);
+ fl->c.flc_type = type;
+ lockd_set_file_lock_range3(fl, lock->lock_start, lock->lock_len);
+
+ mode = lock_to_openmode(fl);
+ if (is_test)
+ mode = O_RDWR;
+
+ error = nlm_lookup_file(rqstp, &file, lock, mode);
+ switch (error) {
+ case nlm_granted:
+ break;
+ case nlm__int__stale_fh:
+ case nlm__int__failed:
+ return nlm_lck_denied_nolocks;
+ default:
+ return error;
+ }
+ *filp = file;
+
+ fl->c.flc_flags = FL_POSIX;
+ if (is_test)
+ fl->c.flc_file = nlmsvc_file_file(file);
+ else
+ fl->c.flc_file = file->f_file[mode];
+ fl->c.flc_pid = current->tgid;
+ fl->fl_lmops = &nlmsvc_lock_operations;
+ nlmsvc_locks_init_private(fl, host, (pid_t)lock->svid);
+ if (!fl->c.flc_owner)
+ return nlm_lck_denied_nolocks;
+
+ return nlm_granted;
+}
+
#ifdef CONFIG_LOCKD_V4
static inline __be32 cast_status(__be32 status)
{
@@ -178,10 +278,79 @@ __nlmsvc_proc_test(struct svc_rqst *rqstp, struct lockd_res *resp)
return rc;
}
-static __be32
-nlmsvc_proc_test(struct svc_rqst *rqstp)
+/**
+ * nlmsvc_proc_test - TEST: Check for conflicting lock
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_drop_reply: Do not send an RPC reply.
+ *
+ * RPC synopsis:
+ * nlm_testres NLM_TEST(nlm_testargs) = 1;
+ *
+ * Permissible procedure status codes:
+ * %LCK_GRANTED: The server would be able to grant the
+ * requested lock.
+ * %LCK_DENIED: The requested lock conflicted with existing
+ * lock reservations for the file.
+ * %LCK_DENIED_NOLOCKS: The server could not allocate the resources
+ * needed to process the request.
+ * %LCK_DENIED_GRACE_PERIOD: The server has recently restarted and is
+ * re-establishing existing locks, and is not
+ * yet ready to accept normal service requests.
+ */
+static __be32 nlmsvc_proc_test(struct svc_rqst *rqstp)
{
- return __nlmsvc_proc_test(rqstp, rqstp->rq_resp);
+ struct nlm_testargs_wrapper *argp = rqstp->rq_argp;
+ unsigned char type = argp->xdrgen.exclusive ? F_WRLCK : F_RDLCK;
+ struct nlm_testres_wrapper *resp = rqstp->rq_resp;
+ struct nlm_file *file = NULL;
+ struct nlm_host *host;
+
+ resp->xdrgen.cookie = argp->xdrgen.cookie;
+
+ resp->xdrgen.test_stat.stat = nlm_lck_denied_nolocks;
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
+ if (!host)
+ goto out;
+
+ resp->xdrgen.test_stat.stat =
+ nlm3svc_lookup_file(rqstp, host, &argp->lock, &file,
+ &argp->xdrgen.alock, type);
+ if (resp->xdrgen.test_stat.stat)
+ goto out;
+
+ resp->xdrgen.test_stat.stat =
+ cast_status(nlmsvc_testlock(rqstp, file, host, &argp->lock,
+ &resp->lock));
+ nlmsvc_release_lockowner(&argp->lock);
+
+ if (resp->xdrgen.test_stat.stat == nlm_lck_denied) {
+ struct lockd_lock *conf = &resp->lock;
+ struct nlm_holder *holder = &resp->xdrgen.test_stat.u.holder;
+
+ holder->exclusive = (conf->fl.c.flc_type != F_RDLCK);
+ holder->uppid = conf->svid;
+ holder->oh.len = conf->oh.len;
+ holder->oh.data = conf->oh.data;
+ holder->l_offset = min_t(loff_t, conf->fl.fl_start,
+ NLM_OFFSET_MAX);
+ if (conf->fl.fl_end == OFFSET_MAX)
+ holder->l_len = 0;
+ else
+ holder->l_len = min_t(loff_t,
+ conf->fl.fl_end -
+ conf->fl.fl_start + 1,
+ NLM_OFFSET_MAX);
+ }
+
+out:
+ if (file)
+ nlm_release_file(file);
+ nlmsvc_release_host(host);
+ return resp->xdrgen.test_stat.stat == nlm__int__drop_reply ?
+ rpc_drop_reply : rpc_success;
}
static __be32
@@ -592,15 +761,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = XDR_void,
.pc_name = "NULL",
},
- [NLMPROC_TEST] = {
- .pc_func = nlmsvc_proc_test,
- .pc_decode = nlmsvc_decode_testargs,
- .pc_encode = nlmsvc_encode_testres,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct lockd_res),
- .pc_xdrressize = Ck+St+2+No+Rg,
- .pc_name = "TEST",
+ [NLM_TEST] = {
+ .pc_func = nlmsvc_proc_test,
+ .pc_decode = nlm_svc_decode_nlm_testargs,
+ .pc_encode = nlm_svc_encode_nlm_testres,
+ .pc_argsize = sizeof(struct nlm_testargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = sizeof(struct nlm_testres_wrapper),
+ .pc_xdrressize = NLM3_nlm_testres_sz,
+ .pc_name = "TEST",
},
[NLMPROC_LOCK] = {
.pc_func = nlmsvc_proc_lock,
@@ -828,6 +997,8 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
* Storage requirements for XDR arguments and results
*/
union nlmsvc_xdrstore {
+ struct nlm_testargs_wrapper testargs;
+ struct nlm_testres_wrapper testres;
struct lockd_args args;
struct lockd_res res;
struct lockd_reboot reboot;
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 15/38] lockd: Use xdrgen XDR functions for the NLMv3 LOCK procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (13 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 14/38] lockd: Use xdrgen XDR functions for the NLMv3 TEST procedure Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 16/38] lockd: Use xdrgen XDR functions for the NLMv3 CANCEL procedure Chuck Lever
` (23 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
The NLM LOCK procedure requires the same host and file lookup
operations established in the TEST procedure conversion. This
patch extends the xdrgen migration to the LOCK procedure,
leveraging the shared nlm3svc_lookup_host() and
nlm3svc_lookup_file() helpers to establish consistent patterns
across the series.
This patch converts the LOCK procedure to use xdrgen functions
nlm_svc_decode_nlm_lockargs and nlm_svc_encode_nlm_res generated
from the NLM version 3 protocol specification. The procedure
handler uses xdrgen types through wrapper structures that bridge
between generated code and the legacy lockd_lock representation
still used by the core lockd logic.
Setting pc_argzero to zero is safe because the generated decoder
fills the argp->xdrgen subfields before the procedure runs, so
the zeroing memset performed by the dispatch layer is not needed.
The cookie and lock members of the wrapper are populated
explicitly in nlm_netobj_to_cookie() and nlm3svc_lookup_file()
rather than relying on zero-initialization.
The hand-rolled svcxdr_decode_cookie() previously substituted a
four-byte zero cookie when a zero-length cookie arrived on the
wire, a compatibility shim for HP-UX clients that had been
carried in fs/lockd/ since the original import. The xdrgen
decoder reproduces the cookie verbatim, and
nlm_netobj_to_cookie() copies whatever length the peer sent. As
subsequent patches replace the remaining call sites of
svcxdr_decode_cookie(), this series retires that HP-UX compat
behavior on the server side.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 118 +++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 106 insertions(+), 12 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 7794e6f88a71..66bc9a2efddb 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -51,6 +51,30 @@ struct nlm_testres_wrapper {
static_assert(offsetof(struct nlm_testres_wrapper, xdrgen) == 0);
+struct nlm_lockargs_wrapper {
+ struct nlm_lockargs xdrgen;
+ struct lockd_cookie cookie;
+ struct lockd_lock lock;
+};
+
+static_assert(offsetof(struct nlm_lockargs_wrapper, xdrgen) == 0);
+
+struct nlm_res_wrapper {
+ struct nlm_res xdrgen;
+};
+
+static_assert(offsetof(struct nlm_res_wrapper, xdrgen) == 0);
+
+static __be32
+nlm_netobj_to_cookie(struct lockd_cookie *cookie, netobj *object)
+{
+ if (object->len > NLM_MAXCOOKIELEN)
+ return nlm_lck_denied_nolocks;
+ cookie->len = object->len;
+ memcpy(cookie->data, object->data, object->len);
+ return nlm_granted;
+}
+
static struct nlm_host *
nlm3svc_lookup_host(struct svc_rqst *rqstp, string caller, bool monitored)
{
@@ -385,10 +409,79 @@ __nlmsvc_proc_lock(struct svc_rqst *rqstp, struct lockd_res *resp)
return rc;
}
+static __be32
+nlmsvc_do_lock(struct svc_rqst *rqstp, bool monitored)
+{
+ struct nlm_lockargs_wrapper *argp = rqstp->rq_argp;
+ unsigned char type = argp->xdrgen.exclusive ? F_WRLCK : F_RDLCK;
+ struct nlm_res_wrapper *resp = rqstp->rq_resp;
+ struct nlm_file *file = NULL;
+ struct nlm_host *host = NULL;
+
+ resp->xdrgen.cookie = argp->xdrgen.cookie;
+
+ resp->xdrgen.stat.stat = nlm_netobj_to_cookie(&argp->cookie,
+ &argp->xdrgen.cookie);
+ if (resp->xdrgen.stat.stat)
+ goto out;
+
+ resp->xdrgen.stat.stat = nlm_lck_denied_nolocks;
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name,
+ monitored);
+ if (!host)
+ goto out;
+
+ resp->xdrgen.stat.stat = nlm3svc_lookup_file(rqstp, host, &argp->lock,
+ &file, &argp->xdrgen.alock,
+ type);
+ if (resp->xdrgen.stat.stat)
+ goto out;
+
+ resp->xdrgen.stat.stat = cast_status(nlmsvc_lock(rqstp, file, host,
+ &argp->lock,
+ argp->xdrgen.block,
+ &argp->cookie,
+ argp->xdrgen.reclaim));
+
+ nlmsvc_release_lockowner(&argp->lock);
+
+out:
+ if (file)
+ nlm_release_file(file);
+ nlmsvc_release_host(host);
+ return resp->xdrgen.stat.stat == nlm__int__drop_reply ?
+ rpc_drop_reply : rpc_success;
+}
+
+/**
+ * nlmsvc_proc_lock - LOCK: Establish a monitored lock
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_drop_reply: Do not send an RPC reply.
+ *
+ * RPC synopsis:
+ * nlm_res NLM_LOCK(nlm_lockargs) = 2;
+ *
+ * Permissible procedure status codes:
+ * %LCK_GRANTED: The requested lock was granted.
+ * %LCK_DENIED: The requested lock conflicted with existing
+ * lock reservations for the file.
+ * %LCK_DENIED_NOLOCKS: The server could not allocate the resources
+ * needed to process the request.
+ * %LCK_BLOCKED: The blocking request cannot be granted
+ * immediately. The server will send an
+ * NLM_GRANTED callback to the client when
+ * the lock can be granted.
+ * %LCK_DENIED_GRACE_PERIOD: The server has recently restarted and is
+ * re-establishing existing locks, and is not
+ * yet ready to accept normal service requests.
+ */
static __be32
nlmsvc_proc_lock(struct svc_rqst *rqstp)
{
- return __nlmsvc_proc_lock(rqstp, rqstp->rq_resp);
+ return nlmsvc_do_lock(rqstp, true);
}
static __be32
@@ -674,7 +767,7 @@ nlmsvc_proc_nm_lock(struct svc_rqst *rqstp)
dprintk("lockd: NM_LOCK called\n");
argp->monitor = 0; /* just clean the monitor flag */
- return nlmsvc_proc_lock(rqstp);
+ return __nlmsvc_proc_lock(rqstp, rqstp->rq_resp);
}
/*
@@ -771,15 +864,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = NLM3_nlm_testres_sz,
.pc_name = "TEST",
},
- [NLMPROC_LOCK] = {
- .pc_func = nlmsvc_proc_lock,
- .pc_decode = nlmsvc_decode_lockargs,
- .pc_encode = nlmsvc_encode_res,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct lockd_res),
- .pc_xdrressize = Ck+St,
- .pc_name = "LOCK",
+ [NLM_LOCK] = {
+ .pc_func = nlmsvc_proc_lock,
+ .pc_decode = nlm_svc_decode_nlm_lockargs,
+ .pc_encode = nlm_svc_encode_nlm_res,
+ .pc_argsize = sizeof(struct nlm_lockargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = sizeof(struct nlm_res_wrapper),
+ .pc_xdrressize = NLM3_nlm_res_sz,
+ .pc_name = "LOCK",
},
[NLMPROC_CANCEL] = {
.pc_func = nlmsvc_proc_cancel,
@@ -998,9 +1091,10 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
*/
union nlmsvc_xdrstore {
struct nlm_testargs_wrapper testargs;
+ struct nlm_lockargs_wrapper lockargs;
struct nlm_testres_wrapper testres;
+ struct nlm_res_wrapper res;
struct lockd_args args;
- struct lockd_res res;
struct lockd_reboot reboot;
};
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 16/38] lockd: Use xdrgen XDR functions for the NLMv3 CANCEL procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (14 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 15/38] lockd: Use xdrgen XDR functions for the NLMv3 LOCK procedure Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 17/38] lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK procedure Chuck Lever
` (22 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
The NLM CANCEL procedure allows clients to cancel outstanding
blocked lock requests. This patch continues the xdrgen migration
by converting the CANCEL procedure. CANCEL reuses the
nlm3svc_lookup_host() and nlm3svc_lookup_file() helpers
established in the TEST procedure conversion.
This patch converts the CANCEL procedure to use xdrgen functions
nlm_svc_decode_nlm_cancargs and nlm_svc_encode_nlm_res generated
from the NLM version 3 protocol specification. The procedure
handler uses xdrgen types through a wrapper structure that
bridges between generated code and the legacy lockd_lock
representation still used by the core lockd logic.
Setting pc_argzero to zero is safe because the generated decoder
fills the argp->xdrgen subfields before the procedure runs, so the
zeroing memset performed by the dispatch layer is not needed. The
lock member of the wrapper is populated explicitly in
nlm3svc_lookup_file() rather than relying on zero-initialization.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 71 insertions(+), 10 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 66bc9a2efddb..a5e40ca3f109 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -65,6 +65,13 @@ struct nlm_res_wrapper {
static_assert(offsetof(struct nlm_res_wrapper, xdrgen) == 0);
+struct nlm_cancargs_wrapper {
+ struct nlm_cancargs xdrgen;
+ struct lockd_lock lock;
+};
+
+static_assert(offsetof(struct nlm_cancargs_wrapper, xdrgen) == 0);
+
static __be32
nlm_netobj_to_cookie(struct lockd_cookie *cookie, netobj *object)
{
@@ -517,10 +524,63 @@ __nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct lockd_res *resp)
return rpc_success;
}
+/**
+ * nlmsvc_proc_cancel - CANCEL: Cancel an outstanding blocked lock request
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_drop_reply: Do not send an RPC reply.
+ *
+ * RPC synopsis:
+ * nlm_res NLM_CANCEL(nlm_cancargs) = 3;
+ *
+ * Permissible procedure status codes:
+ * %LCK_GRANTED: The requested lock was canceled.
+ * %LCK_DENIED: There was no lock to cancel.
+ * %LCK_DENIED_GRACE_PERIOD: The server has recently restarted and is
+ * re-establishing existing locks, and is not
+ * yet ready to accept normal service requests.
+ *
+ * The Linux NLM server implementation also returns:
+ * %LCK_DENIED_NOLOCKS: A needed resource could not be allocated.
+ */
static __be32
nlmsvc_proc_cancel(struct svc_rqst *rqstp)
{
- return __nlmsvc_proc_cancel(rqstp, rqstp->rq_resp);
+ struct nlm_cancargs_wrapper *argp = rqstp->rq_argp;
+ unsigned char type = argp->xdrgen.exclusive ? F_WRLCK : F_RDLCK;
+ struct nlm_res_wrapper *resp = rqstp->rq_resp;
+ struct net *net = SVC_NET(rqstp);
+ struct nlm_host *host = NULL;
+ struct nlm_file *file = NULL;
+
+ resp->xdrgen.cookie = argp->xdrgen.cookie;
+
+ resp->xdrgen.stat.stat = nlm_lck_denied_grace_period;
+ if (locks_in_grace(net))
+ goto out;
+
+ resp->xdrgen.stat.stat = nlm_lck_denied_nolocks;
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
+ if (!host)
+ goto out;
+
+ resp->xdrgen.stat.stat = nlm3svc_lookup_file(rqstp, host, &argp->lock,
+ &file, &argp->xdrgen.alock,
+ type);
+ if (resp->xdrgen.stat.stat)
+ goto out;
+
+ resp->xdrgen.stat.stat = nlmsvc_cancel_blocked(net, file, &argp->lock);
+ nlmsvc_release_lockowner(&argp->lock);
+
+out:
+ if (file)
+ nlm_release_file(file);
+ nlmsvc_release_host(host);
+ return resp->xdrgen.stat.stat == nlm__int__drop_reply ?
+ rpc_drop_reply : rpc_success;
}
/*
@@ -874,15 +934,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = NLM3_nlm_res_sz,
.pc_name = "LOCK",
},
- [NLMPROC_CANCEL] = {
- .pc_func = nlmsvc_proc_cancel,
- .pc_decode = nlmsvc_decode_cancargs,
- .pc_encode = nlmsvc_encode_res,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct lockd_res),
- .pc_xdrressize = Ck+St,
- .pc_name = "CANCEL",
+ [NLM_CANCEL] = {
+ .pc_func = nlmsvc_proc_cancel,
+ .pc_decode = nlm_svc_decode_nlm_cancargs,
+ .pc_encode = nlm_svc_encode_nlm_res,
+ .pc_argsize = sizeof(struct nlm_cancargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = sizeof(struct nlm_res_wrapper),
+ .pc_xdrressize = NLM3_nlm_res_sz,
+ .pc_name = "CANCEL",
},
[NLMPROC_UNLOCK] = {
.pc_func = nlmsvc_proc_unlock,
@@ -1092,6 +1152,7 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
union nlmsvc_xdrstore {
struct nlm_testargs_wrapper testargs;
struct nlm_lockargs_wrapper lockargs;
+ struct nlm_cancargs_wrapper cancargs;
struct nlm_testres_wrapper testres;
struct nlm_res_wrapper res;
struct lockd_args args;
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 17/38] lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (15 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 16/38] lockd: Use xdrgen XDR functions for the NLMv3 CANCEL procedure Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 18/38] lockd: Use xdrgen XDR functions for the NLMv3 GRANTED procedure Chuck Lever
` (21 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
The NLM UNLOCK procedure allows clients to release held locks,
completing the basic lock lifecycle alongside TEST, LOCK, and
CANCEL procedures already converted in this series.
Convert UNLOCK to use the xdrgen functions
nlm_svc_decode_nlm_unlockargs and nlm_svc_encode_nlm_res
generated from the NLM version 3 protocol specification, reusing
the nlm3svc_lookup_host() and nlm3svc_lookup_file() helpers
introduced earlier in the series. The procedure handler uses
xdrgen types through a wrapper structure that bridges between
generated code and the legacy lockd_lock representation still
used by the core lockd logic.
Setting pc_argzero to zero is safe because the generated decoder
fills the argp->xdrgen subfields before the procedure runs, so
the zeroing memset performed by the dispatch layer is not needed.
The lock member of the wrapper is populated explicitly in
nlm3svc_lookup_file() rather than relying on zero-initialization.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 69 insertions(+), 10 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index a5e40ca3f109..ccc6a633df7b 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -72,6 +72,13 @@ struct nlm_cancargs_wrapper {
static_assert(offsetof(struct nlm_cancargs_wrapper, xdrgen) == 0);
+struct nlm_unlockargs_wrapper {
+ struct nlm_unlockargs xdrgen;
+ struct lockd_lock lock;
+};
+
+static_assert(offsetof(struct nlm_unlockargs_wrapper, xdrgen) == 0);
+
static __be32
nlm_netobj_to_cookie(struct lockd_cookie *cookie, netobj *object)
{
@@ -619,10 +626,61 @@ __nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct lockd_res *resp)
return rpc_success;
}
+/**
+ * nlmsvc_proc_unlock - UNLOCK: Remove a lock
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_drop_reply: Do not send an RPC reply.
+ *
+ * RPC synopsis:
+ * nlm_res NLM_UNLOCK(nlm_unlockargs) = 4;
+ *
+ * Permissible procedure status codes:
+ * %LCK_GRANTED: The requested lock was released.
+ * %LCK_DENIED_GRACE_PERIOD: The server has recently restarted and is
+ * re-establishing existing locks, and is not
+ * yet ready to accept normal service requests.
+ *
+ * The Linux NLM server implementation also returns:
+ * %LCK_DENIED_NOLOCKS: A needed resource could not be allocated.
+ */
static __be32
nlmsvc_proc_unlock(struct svc_rqst *rqstp)
{
- return __nlmsvc_proc_unlock(rqstp, rqstp->rq_resp);
+ struct nlm_unlockargs_wrapper *argp = rqstp->rq_argp;
+ struct nlm_res_wrapper *resp = rqstp->rq_resp;
+ struct net *net = SVC_NET(rqstp);
+ struct nlm_host *host = NULL;
+ struct nlm_file *file = NULL;
+
+ resp->xdrgen.cookie = argp->xdrgen.cookie;
+
+ resp->xdrgen.stat.stat = nlm_lck_denied_grace_period;
+ if (locks_in_grace(net))
+ goto out;
+
+ resp->xdrgen.stat.stat = nlm_lck_denied_nolocks;
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
+ if (!host)
+ goto out;
+
+ resp->xdrgen.stat.stat = nlm3svc_lookup_file(rqstp, host, &argp->lock,
+ &file, &argp->xdrgen.alock,
+ F_UNLCK);
+ if (resp->xdrgen.stat.stat)
+ goto out;
+
+ resp->xdrgen.stat.stat = nlmsvc_unlock(net, file, &argp->lock);
+ nlmsvc_release_lockowner(&argp->lock);
+
+out:
+ if (file)
+ nlm_release_file(file);
+ nlmsvc_release_host(host);
+ return resp->xdrgen.stat.stat == nlm__int__drop_reply ?
+ rpc_drop_reply : rpc_success;
}
/*
@@ -944,15 +1002,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = NLM3_nlm_res_sz,
.pc_name = "CANCEL",
},
- [NLMPROC_UNLOCK] = {
- .pc_func = nlmsvc_proc_unlock,
- .pc_decode = nlmsvc_decode_unlockargs,
- .pc_encode = nlmsvc_encode_res,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct lockd_res),
- .pc_xdrressize = Ck+St,
- .pc_name = "UNLOCK",
+ [NLM_UNLOCK] = {
+ .pc_func = nlmsvc_proc_unlock,
+ .pc_decode = nlm_svc_decode_nlm_unlockargs,
+ .pc_encode = nlm_svc_encode_nlm_res,
+ .pc_argsize = sizeof(struct nlm_unlockargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = sizeof(struct nlm_res_wrapper),
+ .pc_xdrressize = NLM3_nlm_res_sz,
+ .pc_name = "UNLOCK",
},
[NLMPROC_GRANTED] = {
.pc_func = nlmsvc_proc_granted,
@@ -1153,6 +1211,7 @@ union nlmsvc_xdrstore {
struct nlm_testargs_wrapper testargs;
struct nlm_lockargs_wrapper lockargs;
struct nlm_cancargs_wrapper cancargs;
+ struct nlm_unlockargs_wrapper unlockargs;
struct nlm_testres_wrapper testres;
struct nlm_res_wrapper res;
struct lockd_args args;
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 18/38] lockd: Use xdrgen XDR functions for the NLMv3 GRANTED procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (16 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 17/38] lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK procedure Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 19/38] lockd: Refactor nlmsvc_callback() Chuck Lever
` (20 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
The NLM GRANTED procedure allows servers to notify clients when
a previously blocked lock request has been granted, completing
the asynchronous lock request flow. This patch converts the NLMv3
GRANTED procedure to use xdrgen-generated XDR functions.
The conversion replaces the legacy decoder with the xdrgen
functions nlm_svc_decode_nlm_testargs and nlm_svc_encode_nlm_res
generated from the NLM version 3 protocol specification. The
procedure handler accesses xdrgen types through a wrapper structure
that bridges between generated code and the legacy lockd_lock
representation still used by the core lockd logic.
A new helper function nlm_lock_to_lockd_lock() converts an xdrgen
nlm_lock into the legacy lockd_lock format. The helper complements
the existing nlm3svc_lookup_host() and nlm3svc_lookup_file()
functions used throughout this series.
Setting pc_argzero to zero is safe because the generated decoder
fills the argp->xdrgen subfields before the procedure runs, so the
zeroing memset performed by the dispatch layer is not needed. The
helper populates each field of the wrapper's lock member that any
downstream consumer reads: fh, oh, svid, and the file_lock byte
range. Because pc_argzero no longer scrubs the rq_argp slot, the
shared nlmclnt_lock_event tracepoint class is updated to source
its byte-range fields from lock->fl.fl_start and lock->fl.fl_end,
which both the client and server populate unconditionally; the old
lock_start and lock_len fields are no longer required by the trace.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 65 +++++++++++++++++++++++++++++++++++++++++++++---------
fs/lockd/trace.h | 12 +++++-----
2 files changed, 61 insertions(+), 16 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index ccc6a633df7b..264212e44ec5 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -89,6 +89,20 @@ nlm_netobj_to_cookie(struct lockd_cookie *cookie, netobj *object)
return nlm_granted;
}
+static __be32
+nlm_lock_to_lockd_lock(struct lockd_lock *lock, struct nlm_lock *alock)
+{
+ if (alock->fh.len != NLM3_FHSIZE)
+ return nlm_lck_denied;
+ lock->fh.size = alock->fh.len;
+ memcpy(lock->fh.data, alock->fh.data, alock->fh.len);
+ lock->oh.len = alock->oh.len;
+ lock->oh.data = alock->oh.data;
+ lock->svid = alock->uppid;
+ lockd_set_file_lock_range3(&lock->fl, alock->l_offset, alock->l_len);
+ return nlm_granted;
+}
+
static struct nlm_host *
nlm3svc_lookup_host(struct svc_rqst *rqstp, string caller, bool monitored)
{
@@ -700,10 +714,41 @@ __nlmsvc_proc_granted(struct svc_rqst *rqstp, struct lockd_res *resp)
return rpc_success;
}
+/**
+ * nlmsvc_proc_granted - GRANTED: Blocked lock has been granted
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ *
+ * RPC synopsis:
+ * nlm_res NLM_GRANTED(nlm_testargs) = 5;
+ *
+ * Permissible procedure status codes:
+ * %LCK_GRANTED: The granted lock was accepted.
+ * %LCK_DENIED: The procedure failed, possibly due to
+ * internal resource constraints.
+ * %LCK_DENIED_GRACE_PERIOD: The client host recently restarted and
+ * its NLM is re-establishing existing locks,
+ * so it is not yet ready to accept callbacks.
+ */
static __be32
nlmsvc_proc_granted(struct svc_rqst *rqstp)
{
- return __nlmsvc_proc_granted(rqstp, rqstp->rq_resp);
+ struct nlm_testargs_wrapper *argp = rqstp->rq_argp;
+ struct nlm_res_wrapper *resp = rqstp->rq_resp;
+
+ resp->xdrgen.cookie = argp->xdrgen.cookie;
+
+ resp->xdrgen.stat.stat = nlm_lock_to_lockd_lock(&argp->lock,
+ &argp->xdrgen.alock);
+ if (resp->xdrgen.stat.stat)
+ goto out;
+
+ resp->xdrgen.stat.stat = nlmclnt_grant(svc_addr(rqstp), &argp->lock);
+
+out:
+ return rpc_success;
}
/*
@@ -1012,15 +1057,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = NLM3_nlm_res_sz,
.pc_name = "UNLOCK",
},
- [NLMPROC_GRANTED] = {
- .pc_func = nlmsvc_proc_granted,
- .pc_decode = nlmsvc_decode_testargs,
- .pc_encode = nlmsvc_encode_res,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct lockd_res),
- .pc_xdrressize = Ck+St,
- .pc_name = "GRANTED",
+ [NLM_GRANTED] = {
+ .pc_func = nlmsvc_proc_granted,
+ .pc_decode = nlm_svc_decode_nlm_testargs,
+ .pc_encode = nlm_svc_encode_nlm_res,
+ .pc_argsize = sizeof(struct nlm_testargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = sizeof(struct nlm_res_wrapper),
+ .pc_xdrressize = NLM3_nlm_res_sz,
+ .pc_name = "GRANTED",
},
[NLMPROC_TEST_MSG] = {
.pc_func = nlmsvc_proc_test_msg,
diff --git a/fs/lockd/trace.h b/fs/lockd/trace.h
index aa858d9d406d..a11d04e8c835 100644
--- a/fs/lockd/trace.h
+++ b/fs/lockd/trace.h
@@ -61,8 +61,8 @@ DECLARE_EVENT_CLASS(nlmclnt_lock_event,
__field(u32, svid)
__field(u32, fh)
__field(unsigned long, status)
- __field(u64, start)
- __field(u64, len)
+ __field(loff_t, start)
+ __field(loff_t, end)
__sockaddr(addr, addrlen)
),
@@ -70,16 +70,16 @@ DECLARE_EVENT_CLASS(nlmclnt_lock_event,
__entry->oh = ~crc32_le(0xffffffff, lock->oh.data, lock->oh.len);
__entry->svid = lock->svid;
__entry->fh = nfs_fhandle_hash(&lock->fh);
- __entry->start = lock->lock_start;
- __entry->len = lock->lock_len;
+ __entry->start = lock->fl.fl_start;
+ __entry->end = lock->fl.fl_end;
__entry->status = be32_to_cpu(status);
__assign_sockaddr(addr, addr, addrlen);
),
TP_printk(
- "addr=%pISpc oh=0x%08x svid=0x%08x fh=0x%08x start=%llu len=%llu status=%s",
+ "addr=%pISpc oh=0x%08x svid=0x%08x fh=0x%08x start=%lld end=%lld status=%s",
__get_sockaddr(addr), __entry->oh, __entry->svid,
- __entry->fh, __entry->start, __entry->len,
+ __entry->fh, __entry->start, __entry->end,
show_nlm_status(__entry->status)
)
);
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 19/38] lockd: Refactor nlmsvc_callback()
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (17 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 18/38] lockd: Use xdrgen XDR functions for the NLMv3 GRANTED procedure Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 20/38] lockd: Use xdrgen XDR functions for the NLMv3 TEST_MSG procedure Chuck Lever
` (19 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
The xdrgen-based XDR conversion requires each RPC procedure to
extract its own arguments, since xdrgen generates distinct
argument structures for each procedure rather than using a
single shared type.
Move the host lookup logic from nlmsvc_callback() into each
of the five MSG procedure handlers (TEST_MSG, LOCK_MSG,
CANCEL_MSG, UNLOCK_MSG, and GRANTED_MSG). Each handler now
performs its own host lookup from rqstp->rq_argp and passes
the resulting host pointer to nlmsvc_callback(). This
establishes the per-procedure argument-handling pattern that
the subsequent xdrgen conversion patches require.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 72 ++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 54 insertions(+), 18 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 264212e44ec5..2e6afb9a19b9 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -781,20 +781,13 @@ static const struct rpc_call_ops nlmsvc_callback_ops = {
* because we send the callback before the reply proper. I hope this
* doesn't break any clients.
*/
-static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc,
+static __be32
+nlmsvc_callback(struct svc_rqst *rqstp, struct nlm_host *host, u32 proc,
__be32 (*func)(struct svc_rqst *, struct lockd_res *))
{
- struct lockd_args *argp = rqstp->rq_argp;
- struct nlm_host *host;
struct nlm_rqst *call;
__be32 stat;
- host = nlmsvc_lookup_host(rqstp,
- argp->lock.caller,
- argp->lock.len);
- if (host == NULL)
- return rpc_system_err;
-
call = nlm_alloc_call(host);
nlmsvc_release_host(host);
if (call == NULL)
@@ -814,34 +807,77 @@ static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc,
static __be32 nlmsvc_proc_test_msg(struct svc_rqst *rqstp)
{
+ struct lockd_args *argp = rqstp->rq_argp;
+ struct nlm_host *host;
+
dprintk("lockd: TEST_MSG called\n");
- return nlmsvc_callback(rqstp, NLMPROC_TEST_RES, __nlmsvc_proc_test);
+
+ host = nlmsvc_lookup_host(rqstp, argp->lock.caller, argp->lock.len);
+ if (!host)
+ return rpc_system_err;
+
+ return nlmsvc_callback(rqstp, host, NLMPROC_TEST_RES,
+ __nlmsvc_proc_test);
}
static __be32 nlmsvc_proc_lock_msg(struct svc_rqst *rqstp)
{
+ struct lockd_args *argp = rqstp->rq_argp;
+ struct nlm_host *host;
+
dprintk("lockd: LOCK_MSG called\n");
- return nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, __nlmsvc_proc_lock);
+
+ host = nlmsvc_lookup_host(rqstp, argp->lock.caller, argp->lock.len);
+ if (!host)
+ return rpc_system_err;
+
+ return nlmsvc_callback(rqstp, host, NLMPROC_LOCK_RES,
+ __nlmsvc_proc_lock);
}
static __be32 nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp)
{
+ struct lockd_args *argp = rqstp->rq_argp;
+ struct nlm_host *host;
+
dprintk("lockd: CANCEL_MSG called\n");
- return nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, __nlmsvc_proc_cancel);
+
+ host = nlmsvc_lookup_host(rqstp, argp->lock.caller, argp->lock.len);
+ if (!host)
+ return rpc_system_err;
+
+ return nlmsvc_callback(rqstp, host, NLMPROC_CANCEL_RES,
+ __nlmsvc_proc_cancel);
}
-static __be32
-nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp)
+static __be32 nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp)
{
+ struct lockd_args *argp = rqstp->rq_argp;
+ struct nlm_host *host;
+
dprintk("lockd: UNLOCK_MSG called\n");
- return nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, __nlmsvc_proc_unlock);
+
+ host = nlmsvc_lookup_host(rqstp, argp->lock.caller, argp->lock.len);
+ if (!host)
+ return rpc_system_err;
+
+ return nlmsvc_callback(rqstp, host, NLMPROC_UNLOCK_RES,
+ __nlmsvc_proc_unlock);
}
-static __be32
-nlmsvc_proc_granted_msg(struct svc_rqst *rqstp)
+static __be32 nlmsvc_proc_granted_msg(struct svc_rqst *rqstp)
{
+ struct lockd_args *argp = rqstp->rq_argp;
+ struct nlm_host *host;
+
dprintk("lockd: GRANTED_MSG called\n");
- return nlmsvc_callback(rqstp, NLMPROC_GRANTED_RES, __nlmsvc_proc_granted);
+
+ host = nlmsvc_lookup_host(rqstp, argp->lock.caller, argp->lock.len);
+ if (!host)
+ return rpc_system_err;
+
+ return nlmsvc_callback(rqstp, host, NLMPROC_GRANTED_RES,
+ __nlmsvc_proc_granted);
}
/*
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 20/38] lockd: Use xdrgen XDR functions for the NLMv3 TEST_MSG procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (18 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 19/38] lockd: Refactor nlmsvc_callback() Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 21/38] lockd: Use xdrgen XDR functions for the NLMv3 LOCK_MSG procedure Chuck Lever
` (18 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Continue the xdrgen migration by converting NLMv3 TEST_MSG, the
async counterpart to TEST that clients use to check lock
availability without blocking. The procedure now uses
nlm_svc_decode_nlm_testargs and nlm_svc_encode_void, generated
from the NLM version 3 protocol specification. The procedure
handler reaches the xdrgen types through the
nlm_testargs_wrapper structure, which bridges between generated
code and the legacy lockd_lock representation.
Setting pc_argzero to zero is safe because the generated decoder
fills the argp->xdrgen subfields before the procedure runs, so
the zeroing memset performed by the dispatch layer is not
needed. The lock member of the wrapper is populated explicitly
in nlm3svc_lookup_file() rather than relying on
zero-initialization.
The NLM async callback mechanism uses client-side functions
which continue to take legacy results like struct lockd_res,
preventing TEST and TEST_MSG from sharing code for now.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 112 ++++++++++++++++++++++++++++++-----------------------
1 file changed, 64 insertions(+), 48 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 2e6afb9a19b9..cd32cfc62338 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -296,40 +296,6 @@ static __be32 nlmsvc_proc_null(struct svc_rqst *rqstp)
return rpc_success;
}
-/*
- * TEST: Check for conflicting lock
- */
-static __be32
-__nlmsvc_proc_test(struct svc_rqst *rqstp, struct lockd_res *resp)
-{
- struct lockd_args *argp = rqstp->rq_argp;
- struct nlm_host *host;
- struct nlm_file *file;
- __be32 rc = rpc_success;
-
- dprintk("lockd: TEST called\n");
- resp->cookie = argp->cookie;
-
- /* Obtain client and file */
- if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
- 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__int__drop_reply)
- rc = rpc_drop_reply;
- else
- dprintk("lockd: TEST status %d vers %d\n",
- ntohl(resp->status), rqstp->rq_vers);
-
- nlmsvc_release_lockowner(&argp->lock);
- nlmsvc_release_host(host);
- nlm_release_file(file);
- return rc;
-}
-
/**
* nlmsvc_proc_test - TEST: Check for conflicting lock
* @rqstp: RPC transaction context
@@ -805,19 +771,69 @@ nlmsvc_callback(struct svc_rqst *rqstp, struct nlm_host *host, u32 proc,
return rpc_success;
}
+static __be32
+__nlmsvc_proc_test_msg(struct svc_rqst *rqstp, struct lockd_res *resp)
+{
+ struct nlm_testargs_wrapper *argp = rqstp->rq_argp;
+ unsigned char type = argp->xdrgen.exclusive ? F_WRLCK : F_RDLCK;
+ struct nlm_lockowner *owner;
+ struct nlm_file *file = NULL;
+ struct nlm_host *host = NULL;
+
+ resp->status = nlm_lck_denied_nolocks;
+ if (nlm_netobj_to_cookie(&resp->cookie, &argp->xdrgen.cookie))
+ goto out;
+
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
+ if (!host)
+ goto out;
+
+ resp->status = nlm3svc_lookup_file(rqstp, host, &argp->lock,
+ &file, &argp->xdrgen.alock, type);
+ if (resp->status)
+ goto out;
+
+ owner = argp->lock.fl.c.flc_owner;
+ resp->status = cast_status(nlmsvc_testlock(rqstp, file, host,
+ &argp->lock, &resp->lock));
+ nlmsvc_put_lockowner(owner);
+
+out:
+ if (file)
+ nlm_release_file(file);
+ nlmsvc_release_host(host);
+ return resp->status == nlm__int__drop_reply ? rpc_drop_reply : rpc_success;
+}
+
+/**
+ * nlmsvc_proc_test_msg - TEST_MSG: Check for conflicting lock
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_drop_reply: Do not send an RPC reply.
+ * %rpc_garbage_args: The request arguments are malformed.
+ * %rpc_system_err: RPC execution failed.
+ *
+ * RPC synopsis:
+ * void NLMPROC_TEST_MSG(nlm_testargs) = 6;
+ *
+ * The response to this request is delivered via the TEST_RES procedure.
+ */
static __be32 nlmsvc_proc_test_msg(struct svc_rqst *rqstp)
{
- struct lockd_args *argp = rqstp->rq_argp;
- struct nlm_host *host;
+ struct nlm_testargs_wrapper *argp = rqstp->rq_argp;
+ struct nlm_host *host;
- dprintk("lockd: TEST_MSG called\n");
+ if (argp->xdrgen.cookie.len > NLM_MAXCOOKIELEN)
+ return rpc_garbage_args;
- host = nlmsvc_lookup_host(rqstp, argp->lock.caller, argp->lock.len);
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
if (!host)
return rpc_system_err;
return nlmsvc_callback(rqstp, host, NLMPROC_TEST_RES,
- __nlmsvc_proc_test);
+ __nlmsvc_proc_test_msg);
}
static __be32 nlmsvc_proc_lock_msg(struct svc_rqst *rqstp)
@@ -1103,15 +1119,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = NLM3_nlm_res_sz,
.pc_name = "GRANTED",
},
- [NLMPROC_TEST_MSG] = {
- .pc_func = nlmsvc_proc_test_msg,
- .pc_decode = nlmsvc_decode_testargs,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "TEST_MSG",
+ [NLM_TEST_MSG] = {
+ .pc_func = nlmsvc_proc_test_msg,
+ .pc_decode = nlm_svc_decode_nlm_testargs,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = sizeof(struct nlm_testargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "TEST_MSG",
},
[NLMPROC_LOCK_MSG] = {
.pc_func = nlmsvc_proc_lock_msg,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 21/38] lockd: Use xdrgen XDR functions for the NLMv3 LOCK_MSG procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (19 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 20/38] lockd: Use xdrgen XDR functions for the NLMv3 TEST_MSG procedure Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 22/38] lockd: Use xdrgen XDR functions for the NLMv3 CANCEL_MSG procedure Chuck Lever
` (17 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Continue the xdrgen migration by converting NLMv3 LOCK_MSG, the
async counterpart to LOCK that clients use to request locks that
may block. The procedure now uses nlm_svc_decode_nlm_lockargs and
nlm_svc_encode_void, generated from the NLM version 3 protocol
specification. The procedure handler reaches the xdrgen types
through the nlm_lockargs_wrapper structure, which bridges between
generated code and the legacy lockd_lock representation.
Setting pc_argzero to zero is safe because the generated decoder
fills the argp->xdrgen subfields before the procedure runs,
so the zeroing memset performed by the dispatch layer is not
needed. The lock member of the wrapper is populated explicitly in
nlm3svc_lookup_file() rather than relying on zero-initialization.
The NLM async callback mechanism uses client-side functions which
continue to take legacy results like struct lockd_res, preventing
LOCK and LOCK_MSG from sharing code for now.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 77 ++++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 63 insertions(+), 14 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index cd32cfc62338..17625d43dc37 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -836,19 +836,68 @@ static __be32 nlmsvc_proc_test_msg(struct svc_rqst *rqstp)
__nlmsvc_proc_test_msg);
}
+static __be32
+__nlmsvc_proc_lock_msg(struct svc_rqst *rqstp, struct lockd_res *resp)
+{
+ struct nlm_lockargs_wrapper *argp = rqstp->rq_argp;
+ unsigned char type = argp->xdrgen.exclusive ? F_WRLCK : F_RDLCK;
+ struct nlm_file *file = NULL;
+ struct nlm_host *host = NULL;
+
+ resp->status = nlm_lck_denied_nolocks;
+ if (nlm_netobj_to_cookie(&resp->cookie, &argp->xdrgen.cookie))
+ goto out;
+
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, true);
+ if (!host)
+ goto out;
+
+ resp->status = nlm3svc_lookup_file(rqstp, host, &argp->lock,
+ &file, &argp->xdrgen.alock, type);
+ if (resp->status)
+ goto out;
+
+ resp->status = cast_status(nlmsvc_lock(rqstp, file, host, &argp->lock,
+ argp->xdrgen.block, &resp->cookie,
+ argp->xdrgen.reclaim));
+ nlmsvc_release_lockowner(&argp->lock);
+
+out:
+ if (file)
+ nlm_release_file(file);
+ nlmsvc_release_host(host);
+ return resp->status == nlm__int__drop_reply ? rpc_drop_reply : rpc_success;
+}
+
+/**
+ * nlmsvc_proc_lock_msg - LOCK_MSG: Establish a monitored lock
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_drop_reply: Do not send an RPC reply.
+ * %rpc_garbage_args: The request arguments are malformed.
+ * %rpc_system_err: RPC execution failed.
+ *
+ * RPC synopsis:
+ * void NLMPROC_LOCK_MSG(nlm_lockargs) = 7;
+ *
+ * The response to this request is delivered via the LOCK_RES procedure.
+ */
static __be32 nlmsvc_proc_lock_msg(struct svc_rqst *rqstp)
{
- struct lockd_args *argp = rqstp->rq_argp;
- struct nlm_host *host;
+ struct nlm_lockargs_wrapper *argp = rqstp->rq_argp;
+ struct nlm_host *host;
- dprintk("lockd: LOCK_MSG called\n");
+ if (argp->xdrgen.cookie.len > NLM_MAXCOOKIELEN)
+ return rpc_garbage_args;
- host = nlmsvc_lookup_host(rqstp, argp->lock.caller, argp->lock.len);
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
if (!host)
return rpc_system_err;
return nlmsvc_callback(rqstp, host, NLMPROC_LOCK_RES,
- __nlmsvc_proc_lock);
+ __nlmsvc_proc_lock_msg);
}
static __be32 nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp)
@@ -1129,15 +1178,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = XDR_void,
.pc_name = "TEST_MSG",
},
- [NLMPROC_LOCK_MSG] = {
- .pc_func = nlmsvc_proc_lock_msg,
- .pc_decode = nlmsvc_decode_lockargs,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "LOCK_MSG",
+ [NLM_LOCK_MSG] = {
+ .pc_func = nlmsvc_proc_lock_msg,
+ .pc_decode = nlm_svc_decode_nlm_lockargs,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = sizeof(struct nlm_lockargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "LOCK_MSG",
},
[NLMPROC_CANCEL_MSG] = {
.pc_func = nlmsvc_proc_cancel_msg,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 22/38] lockd: Use xdrgen XDR functions for the NLMv3 CANCEL_MSG procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (20 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 21/38] lockd: Use xdrgen XDR functions for the NLMv3 LOCK_MSG procedure Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 23/38] lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK_MSG procedure Chuck Lever
` (16 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
The CANCEL_MSG procedure is part of NLM's asynchronous lock
request flow, where clients send CANCEL_MSG to cancel pending
lock requests. This patch continues the xdrgen migration by
converting CANCEL_MSG to use generated XDR functions.
This patch converts the CANCEL_MSG procedure to use xdrgen
functions nlm_svc_decode_nlm_cancargs and nlm_svc_encode_void
generated from the NLM version 3 protocol specification. The
procedure handler uses xdrgen types through the
nlm_cancargs_wrapper structure that bridges between generated
code and the legacy lockd_lock representation.
Setting pc_argzero to zero is safe because the generated decoder
fills the argp->xdrgen subfields before the procedure runs, so the
zeroing memset performed by the dispatch layer is not needed. The
lock member of the wrapper is populated explicitly in
nlm3svc_lookup_file() rather than relying on zero-initialization.
The previous hand-written decoder in svcxdr_decode_cookie()
rewrote a zero-length NLM cookie into a four-byte zero cookie,
with a comment attributing the substitution to HP-UX clients.
The xdrgen-generated netobj decoder performs no such rewrite, so
a zero-length request cookie now round-trips unchanged into the
CANCEL_RES reply. HP-UX has reached end of support, and CANCEL_MSG
is fire-and-forget with no client-side reply matching on the NLM
cookie, so the workaround is dropped intentionally here.
The NLM async callback mechanism uses client-side functions
which continue to take legacy results like struct lockd_res,
preventing CANCEL and CANCEL_MSG from sharing code for now.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 114 +++++++++++++++++++++++++++++++----------------------
1 file changed, 67 insertions(+), 47 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 17625d43dc37..d055079c9485 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -478,39 +478,6 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp)
return nlmsvc_do_lock(rqstp, true);
}
-static __be32
-__nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct lockd_res *resp)
-{
- struct lockd_args *argp = rqstp->rq_argp;
- struct nlm_host *host;
- struct nlm_file *file;
- struct net *net = SVC_NET(rqstp);
-
- dprintk("lockd: CANCEL called\n");
-
- resp->cookie = argp->cookie;
-
- /* Don't accept requests during grace period */
- if (locks_in_grace(net)) {
- resp->status = nlm_lck_denied_grace_period;
- return rpc_success;
- }
-
- /* Obtain client and file */
- if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
- 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));
-
- dprintk("lockd: CANCEL status %d\n", ntohl(resp->status));
- nlmsvc_release_lockowner(&argp->lock);
- nlmsvc_release_host(host);
- nlm_release_file(file);
- return rpc_success;
-}
-
/**
* nlmsvc_proc_cancel - CANCEL: Cancel an outstanding blocked lock request
* @rqstp: RPC transaction context
@@ -900,19 +867,72 @@ static __be32 nlmsvc_proc_lock_msg(struct svc_rqst *rqstp)
__nlmsvc_proc_lock_msg);
}
+static __be32
+__nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp, struct lockd_res *resp)
+{
+ struct nlm_cancargs_wrapper *argp = rqstp->rq_argp;
+ unsigned char type = argp->xdrgen.exclusive ? F_WRLCK : F_RDLCK;
+ struct net *net = SVC_NET(rqstp);
+ struct nlm_file *file = NULL;
+ struct nlm_host *host = NULL;
+
+ resp->status = nlm_lck_denied_nolocks;
+ if (nlm_netobj_to_cookie(&resp->cookie, &argp->xdrgen.cookie))
+ goto out;
+
+ resp->status = nlm_lck_denied_grace_period;
+ if (locks_in_grace(net))
+ goto out;
+
+ resp->status = nlm_lck_denied_nolocks;
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
+ if (!host)
+ goto out;
+
+ resp->status = nlm3svc_lookup_file(rqstp, host, &argp->lock,
+ &file, &argp->xdrgen.alock, type);
+ if (resp->status)
+ goto out;
+
+ resp->status = nlmsvc_cancel_blocked(net, file, &argp->lock);
+ nlmsvc_release_lockowner(&argp->lock);
+
+out:
+ if (file)
+ nlm_release_file(file);
+ nlmsvc_release_host(host);
+ return resp->status == nlm__int__drop_reply ? rpc_drop_reply : rpc_success;
+}
+
+/**
+ * nlmsvc_proc_cancel_msg - CANCEL_MSG: Cancel an outstanding lock request
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_drop_reply: Do not send an RPC reply.
+ * %rpc_garbage_args: The request arguments are malformed.
+ * %rpc_system_err: RPC execution failed.
+ *
+ * RPC synopsis:
+ * void NLMPROC_CANCEL_MSG(nlm_cancargs) = 8;
+ *
+ * The response to this request is delivered via the CANCEL_RES procedure.
+ */
static __be32 nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp)
{
- struct lockd_args *argp = rqstp->rq_argp;
- struct nlm_host *host;
+ struct nlm_cancargs_wrapper *argp = rqstp->rq_argp;
+ struct nlm_host *host;
- dprintk("lockd: CANCEL_MSG called\n");
+ if (argp->xdrgen.cookie.len > NLM_MAXCOOKIELEN)
+ return rpc_garbage_args;
- host = nlmsvc_lookup_host(rqstp, argp->lock.caller, argp->lock.len);
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
if (!host)
return rpc_system_err;
return nlmsvc_callback(rqstp, host, NLMPROC_CANCEL_RES,
- __nlmsvc_proc_cancel);
+ __nlmsvc_proc_cancel_msg);
}
static __be32 nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp)
@@ -1188,15 +1208,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = XDR_void,
.pc_name = "LOCK_MSG",
},
- [NLMPROC_CANCEL_MSG] = {
- .pc_func = nlmsvc_proc_cancel_msg,
- .pc_decode = nlmsvc_decode_cancargs,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "CANCEL_MSG",
+ [NLM_CANCEL_MSG] = {
+ .pc_func = nlmsvc_proc_cancel_msg,
+ .pc_decode = nlm_svc_decode_nlm_cancargs,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = sizeof(struct nlm_cancargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "CANCEL_MSG",
},
[NLMPROC_UNLOCK_MSG] = {
.pc_func = nlmsvc_proc_unlock_msg,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 23/38] lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK_MSG procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (21 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 22/38] lockd: Use xdrgen XDR functions for the NLMv3 CANCEL_MSG procedure Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:13 ` [PATCH 24/38] lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_MSG procedure Chuck Lever
` (15 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Continue the xdrgen migration by converting NLMv3 UNLOCK_MSG, the
async counterpart to UNLOCK that clients use to release locks
without waiting for a reply. The procedure now uses
nlm_svc_decode_nlm_unlockargs and nlm_svc_encode_void, generated
from the NLM version 3 protocol specification. The procedure
handler reaches the xdrgen types through the
nlm_unlockargs_wrapper structure, which bridges between generated
code and the legacy lockd_lock representation.
Setting pc_argzero to zero is safe because the generated decoder
fills the argp->xdrgen subfields before the procedure runs, so
the zeroing memset performed by the dispatch layer is not needed.
The lock member of the wrapper is populated explicitly in
nlm3svc_lookup_file() rather than relying on zero-initialization.
The NLM async callback mechanism uses client-side functions which
continue to take legacy results like struct lockd_res, preventing
UNLOCK and UNLOCK_MSG from sharing code for now.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 116 ++++++++++++++++++++++++++++++-----------------------
1 file changed, 66 insertions(+), 50 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index d055079c9485..d059accfdebd 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -537,42 +537,6 @@ nlmsvc_proc_cancel(struct svc_rqst *rqstp)
rpc_drop_reply : rpc_success;
}
-/*
- * UNLOCK: release a lock
- */
-static __be32
-__nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct lockd_res *resp)
-{
- struct lockd_args *argp = rqstp->rq_argp;
- struct nlm_host *host;
- struct nlm_file *file;
- struct net *net = SVC_NET(rqstp);
-
- dprintk("lockd: UNLOCK called\n");
-
- resp->cookie = argp->cookie;
-
- /* Don't accept new lock requests during grace period */
- if (locks_in_grace(net)) {
- resp->status = nlm_lck_denied_grace_period;
- return rpc_success;
- }
-
- /* Obtain client and file */
- if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
- 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));
-
- dprintk("lockd: UNLOCK status %d\n", ntohl(resp->status));
- nlmsvc_release_lockowner(&argp->lock);
- nlmsvc_release_host(host);
- nlm_release_file(file);
- return rpc_success;
-}
-
/**
* nlmsvc_proc_unlock - UNLOCK: Remove a lock
* @rqstp: RPC transaction context
@@ -935,19 +899,71 @@ static __be32 nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp)
__nlmsvc_proc_cancel_msg);
}
+static __be32
+__nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp, struct lockd_res *resp)
+{
+ struct nlm_unlockargs_wrapper *argp = rqstp->rq_argp;
+ struct net *net = SVC_NET(rqstp);
+ struct nlm_file *file = NULL;
+ struct nlm_host *host = NULL;
+
+ resp->status = nlm_lck_denied_nolocks;
+ if (nlm_netobj_to_cookie(&resp->cookie, &argp->xdrgen.cookie))
+ goto out;
+
+ resp->status = nlm_lck_denied_grace_period;
+ if (locks_in_grace(net))
+ goto out;
+
+ resp->status = nlm_lck_denied_nolocks;
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
+ if (!host)
+ goto out;
+
+ resp->status = nlm3svc_lookup_file(rqstp, host, &argp->lock,
+ &file, &argp->xdrgen.alock, F_UNLCK);
+ if (resp->status)
+ goto out;
+
+ resp->status = nlmsvc_unlock(net, file, &argp->lock);
+ nlmsvc_release_lockowner(&argp->lock);
+
+out:
+ if (file)
+ nlm_release_file(file);
+ nlmsvc_release_host(host);
+ return resp->status == nlm__int__drop_reply ? rpc_drop_reply : rpc_success;
+}
+
+/**
+ * nlmsvc_proc_unlock_msg - UNLOCK_MSG: Remove an existing lock
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_drop_reply: Do not send an RPC reply.
+ * %rpc_garbage_args: The request arguments are malformed.
+ * %rpc_system_err: RPC execution failed.
+ *
+ * RPC synopsis:
+ * void NLMPROC_UNLOCK_MSG(nlm_unlockargs) = 9;
+ *
+ * The response to this request is delivered via the UNLOCK_RES procedure.
+ */
static __be32 nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp)
{
- struct lockd_args *argp = rqstp->rq_argp;
- struct nlm_host *host;
+ struct nlm_unlockargs_wrapper *argp = rqstp->rq_argp;
+ struct nlm_host *host;
- dprintk("lockd: UNLOCK_MSG called\n");
+ if (argp->xdrgen.cookie.len > NLM_MAXCOOKIELEN)
+ return rpc_garbage_args;
- host = nlmsvc_lookup_host(rqstp, argp->lock.caller, argp->lock.len);
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
if (!host)
return rpc_system_err;
return nlmsvc_callback(rqstp, host, NLMPROC_UNLOCK_RES,
- __nlmsvc_proc_unlock);
+ __nlmsvc_proc_unlock_msg);
}
static __be32 nlmsvc_proc_granted_msg(struct svc_rqst *rqstp)
@@ -1218,15 +1234,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = XDR_void,
.pc_name = "CANCEL_MSG",
},
- [NLMPROC_UNLOCK_MSG] = {
- .pc_func = nlmsvc_proc_unlock_msg,
- .pc_decode = nlmsvc_decode_unlockargs,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "UNLOCK_MSG",
+ [NLM_UNLOCK_MSG] = {
+ .pc_func = nlmsvc_proc_unlock_msg,
+ .pc_decode = nlm_svc_decode_nlm_unlockargs,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = sizeof(struct nlm_unlockargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "UNLOCK_MSG",
},
[NLMPROC_GRANTED_MSG] = {
.pc_func = nlmsvc_proc_granted_msg,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 24/38] lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_MSG procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (22 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 23/38] lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK_MSG procedure Chuck Lever
@ 2026-05-12 18:13 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 25/38] lockd: Use xdrgen XDR functions for the NLMv3 TEST_RES procedure Chuck Lever
` (14 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:13 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Continue the xdrgen migration by converting NLMv3 GRANTED_MSG,
the async counterpart to GRANTED that a remote NLM uses to tell
this lockd that a previously blocked client lock request has
become available. The procedure now uses
nlm_svc_decode_nlm_testargs and nlm_svc_encode_void, generated
from the NLM version 3 protocol specification. The procedure
handler reaches the xdrgen types through the
nlm_testargs_wrapper structure, which bridges between generated
code and the legacy lockd_lock representation.
Setting pc_argzero to zero is safe because the generated decoder
fills the argp->xdrgen subfields before the procedure runs, so
the zeroing memset performed by the dispatch layer is not
needed. The lock member of the wrapper is populated explicitly
in __nlmsvc_proc_granted_msg() by nlm_lock_to_lockd_lock()
rather than relying on zero-initialization.
The NLM async callback mechanism uses client-side functions
which continue to take legacy results like struct lockd_res,
preventing GRANTED and GRANTED_MSG from sharing code for now.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 78 ++++++++++++++++++++++++++++++++----------------------
1 file changed, 47 insertions(+), 31 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index d059accfdebd..21a363450d59 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -594,23 +594,6 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp)
rpc_drop_reply : rpc_success;
}
-/*
- * GRANTED: A server calls us to tell that a process' lock request
- * was granted
- */
-static __be32
-__nlmsvc_proc_granted(struct svc_rqst *rqstp, struct lockd_res *resp)
-{
- struct lockd_args *argp = rqstp->rq_argp;
-
- resp->cookie = argp->cookie;
-
- dprintk("lockd: GRANTED called\n");
- resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock);
- dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
- return rpc_success;
-}
-
/**
* nlmsvc_proc_granted - GRANTED: Blocked lock has been granted
* @rqstp: RPC transaction context
@@ -966,19 +949,52 @@ static __be32 nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp)
__nlmsvc_proc_unlock_msg);
}
+static __be32
+__nlmsvc_proc_granted_msg(struct svc_rqst *rqstp, struct lockd_res *resp)
+{
+ struct nlm_testargs_wrapper *argp = rqstp->rq_argp;
+
+ resp->status = nlm_lck_denied;
+ if (nlm_netobj_to_cookie(&resp->cookie, &argp->xdrgen.cookie))
+ goto out;
+
+ if (nlm_lock_to_lockd_lock(&argp->lock, &argp->xdrgen.alock))
+ goto out;
+
+ resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock);
+
+out:
+ return rpc_success;
+}
+
+/**
+ * nlmsvc_proc_granted_msg - GRANTED_MSG: Blocked lock has been granted
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_garbage_args: The request arguments are malformed.
+ * %rpc_system_err: RPC execution failed.
+ *
+ * RPC synopsis:
+ * void NLMPROC_GRANTED_MSG(nlm_testargs) = 10;
+ *
+ * The response to this request is delivered via the GRANTED_RES procedure.
+ */
static __be32 nlmsvc_proc_granted_msg(struct svc_rqst *rqstp)
{
- struct lockd_args *argp = rqstp->rq_argp;
- struct nlm_host *host;
+ struct nlm_testargs_wrapper *argp = rqstp->rq_argp;
+ struct nlm_host *host;
- dprintk("lockd: GRANTED_MSG called\n");
+ if (argp->xdrgen.cookie.len > NLM_MAXCOOKIELEN)
+ return rpc_garbage_args;
- host = nlmsvc_lookup_host(rqstp, argp->lock.caller, argp->lock.len);
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
if (!host)
return rpc_system_err;
return nlmsvc_callback(rqstp, host, NLMPROC_GRANTED_RES,
- __nlmsvc_proc_granted);
+ __nlmsvc_proc_granted_msg);
}
/*
@@ -1244,15 +1260,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = XDR_void,
.pc_name = "UNLOCK_MSG",
},
- [NLMPROC_GRANTED_MSG] = {
- .pc_func = nlmsvc_proc_granted_msg,
- .pc_decode = nlmsvc_decode_testargs,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "GRANTED_MSG",
+ [NLM_GRANTED_MSG] = {
+ .pc_func = nlmsvc_proc_granted_msg,
+ .pc_decode = nlm_svc_decode_nlm_testargs,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = sizeof(struct nlm_testargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "GRANTED_MSG",
},
[NLMPROC_TEST_RES] = {
.pc_func = nlmsvc_proc_null,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 25/38] lockd: Use xdrgen XDR functions for the NLMv3 TEST_RES procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (23 preceding siblings ...)
2026-05-12 18:13 ` [PATCH 24/38] lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_MSG procedure Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 26/38] lockd: Use xdrgen XDR functions for the NLMv3 LOCK_RES procedure Chuck Lever
` (13 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Continue the xdrgen migration by converting NLMv3 TEST_RES,
the callback that a remote NLM uses to return async TEST
results to this lockd. The procedure now uses
nlm_svc_decode_nlm_testres and nlm_svc_encode_void, generated
from the NLM version 3 protocol specification.
Setting pc_argzero to zero is safe because the generated
decoder fills the argp->xdrgen subfields before the procedure
runs, so the zeroing memset performed by the dispatch layer
is no longer needed.
Setting pc_xdrressize to XDR_void reflects that TEST_RES, as
a callback, returns no data; the previous value of St
over-reserved a status word in the reply buffer.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 21a363450d59..ed1164ff431a 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -1270,15 +1270,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = XDR_void,
.pc_name = "GRANTED_MSG",
},
- [NLMPROC_TEST_RES] = {
- .pc_func = nlmsvc_proc_null,
- .pc_decode = nlmsvc_decode_void,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct lockd_res),
- .pc_argzero = sizeof(struct lockd_res),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "TEST_RES",
+ [NLM_TEST_RES] = {
+ .pc_func = nlmsvc_proc_null,
+ .pc_decode = nlm_svc_decode_nlm_testres,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = sizeof(struct nlm_testres),
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "TEST_RES",
},
[NLMPROC_LOCK_RES] = {
.pc_func = nlmsvc_proc_null,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 26/38] lockd: Use xdrgen XDR functions for the NLMv3 LOCK_RES procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (24 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 25/38] lockd: Use xdrgen XDR functions for the NLMv3 TEST_RES procedure Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 27/38] lockd: Use xdrgen XDR functions for the NLMv3 CANCEL_RES procedure Chuck Lever
` (12 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Continue the xdrgen migration by converting NLMv3 LOCK_RES,
the callback that a remote NLM uses to return async LOCK
results to this lockd. The procedure now uses
nlm_svc_decode_nlm_res and nlm_svc_encode_void, generated
from the NLM version 3 protocol specification.
Setting pc_argzero to zero is safe because the generated
decoder fills the argp->xdrgen subfields before the procedure
runs, so the zeroing memset performed by the dispatch layer
is no longer needed.
Setting pc_xdrressize to XDR_void reflects that LOCK_RES, as
a callback, returns no data; the previous value of St
over-reserved a status word in the reply buffer.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index ed1164ff431a..c86ba0b94793 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -1280,15 +1280,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = XDR_void,
.pc_name = "TEST_RES",
},
- [NLMPROC_LOCK_RES] = {
- .pc_func = nlmsvc_proc_null,
- .pc_decode = nlmsvc_decode_void,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct lockd_res),
- .pc_argzero = sizeof(struct lockd_res),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "LOCK_RES",
+ [NLM_LOCK_RES] = {
+ .pc_func = nlmsvc_proc_null,
+ .pc_decode = nlm_svc_decode_nlm_res,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = sizeof(struct nlm_res),
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "LOCK_RES",
},
[NLMPROC_CANCEL_RES] = {
.pc_func = nlmsvc_proc_null,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 27/38] lockd: Use xdrgen XDR functions for the NLMv3 CANCEL_RES procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (25 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 26/38] lockd: Use xdrgen XDR functions for the NLMv3 LOCK_RES procedure Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 28/38] lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK_RES procedure Chuck Lever
` (11 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Continue the xdrgen migration by converting NLMv3 CANCEL_RES,
the callback that a remote NLM uses to return async CANCEL
results to this lockd. The procedure now uses
nlm_svc_decode_nlm_res and nlm_svc_encode_void, generated
from the NLM version 3 protocol specification.
Setting pc_argzero to zero is safe because the generated
decoder fills the argp->xdrgen subfields before the procedure
runs, so the zeroing memset performed by the dispatch layer
is no longer needed.
Setting pc_xdrressize to XDR_void reflects that CANCEL_RES, as
a callback, returns no data; the previous value of St
over-reserved a status word in the reply buffer.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index c86ba0b94793..e7d399afbe83 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -1290,15 +1290,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = XDR_void,
.pc_name = "LOCK_RES",
},
- [NLMPROC_CANCEL_RES] = {
- .pc_func = nlmsvc_proc_null,
- .pc_decode = nlmsvc_decode_void,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct lockd_res),
- .pc_argzero = sizeof(struct lockd_res),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "CANCEL_RES",
+ [NLM_CANCEL_RES] = {
+ .pc_func = nlmsvc_proc_null,
+ .pc_decode = nlm_svc_decode_nlm_res,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = sizeof(struct nlm_res),
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "CANCEL_RES",
},
[NLMPROC_UNLOCK_RES] = {
.pc_func = nlmsvc_proc_null,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 28/38] lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK_RES procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (26 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 27/38] lockd: Use xdrgen XDR functions for the NLMv3 CANCEL_RES procedure Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 29/38] lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_RES procedure Chuck Lever
` (10 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Continue the xdrgen migration by converting NLMv3 UNLOCK_RES,
the callback that a remote NLM uses to return async UNLOCK
results to this lockd. The procedure now uses
nlm_svc_decode_nlm_res and nlm_svc_encode_void, generated
from the NLM version 3 protocol specification.
Setting pc_argzero to zero is safe because the generated
decoder fills the argp->xdrgen subfields before the procedure
runs, so the zeroing memset performed by the dispatch layer
is no longer needed.
Setting pc_xdrressize to XDR_void reflects that UNLOCK_RES, as
a callback, returns no data; the previous value of St
over-reserved a status word in the reply buffer.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index e7d399afbe83..f17d3f8d85ec 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -1300,15 +1300,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = XDR_void,
.pc_name = "CANCEL_RES",
},
- [NLMPROC_UNLOCK_RES] = {
- .pc_func = nlmsvc_proc_null,
- .pc_decode = nlmsvc_decode_void,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct lockd_res),
- .pc_argzero = sizeof(struct lockd_res),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "UNLOCK_RES",
+ [NLM_UNLOCK_RES] = {
+ .pc_func = nlmsvc_proc_null,
+ .pc_decode = nlm_svc_decode_nlm_res,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = sizeof(struct nlm_res),
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "UNLOCK_RES",
},
[NLMPROC_GRANTED_RES] = {
.pc_func = nlmsvc_proc_granted_res,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 29/38] lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_RES procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (27 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 28/38] lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK_RES procedure Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 30/38] lockd: Use xdrgen XDR functions for the NLMv3 SM_NOTIFY procedure Chuck Lever
` (9 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Continue the xdrgen migration by converting NLMv3 GRANTED_RES,
the callback that a remote NLM uses to return async GRANTED
results to this lockd. The procedure now uses
nlm_svc_decode_nlm_res and nlm_svc_encode_void, generated
from the NLM version 3 protocol specification.
Setting pc_argzero to zero is safe because the generated
decoder fills the argp->xdrgen subfields before the procedure
runs, so the zeroing memset performed by the dispatch layer
is no longer needed.
Setting pc_xdrressize to XDR_void reflects that GRANTED_RES, as
a callback, returns no data; the previous value of St
over-reserved a status word in the reply buffer.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 60 +++++++++++++++++++++++++++++++-----------------------
1 file changed, 34 insertions(+), 26 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index f17d3f8d85ec..a2ac747e96ce 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -61,6 +61,7 @@ static_assert(offsetof(struct nlm_lockargs_wrapper, xdrgen) == 0);
struct nlm_res_wrapper {
struct nlm_res xdrgen;
+ struct lockd_cookie cookie;
};
static_assert(offsetof(struct nlm_res_wrapper, xdrgen) == 0);
@@ -997,6 +998,30 @@ static __be32 nlmsvc_proc_granted_msg(struct svc_rqst *rqstp)
__nlmsvc_proc_granted_msg);
}
+/**
+ * nlmsvc_proc_granted_res - GRANTED_RES: Lock Granted result
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ *
+ * RPC synopsis:
+ * void NLMPROC_GRANTED_RES(nlm_res) = 15;
+ */
+static __be32 nlmsvc_proc_granted_res(struct svc_rqst *rqstp)
+{
+ struct nlm_res_wrapper *argp = rqstp->rq_argp;
+
+ if (!nlmsvc_ops)
+ return rpc_success;
+
+ if (nlm_netobj_to_cookie(&argp->cookie, &argp->xdrgen.cookie))
+ return rpc_success;
+ nlmsvc_grant_reply(&argp->cookie, argp->xdrgen.stat.stat);
+
+ return rpc_success;
+}
+
/*
* SHARE: create a DOS share or alter existing share.
*/
@@ -1125,23 +1150,6 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp)
return rpc_success;
}
-/*
- * client sent a GRANTED_RES, let's remove the associated block
- */
-static __be32
-nlmsvc_proc_granted_res(struct svc_rqst *rqstp)
-{
- struct lockd_res *argp = rqstp->rq_argp;
-
- if (!nlmsvc_ops)
- return rpc_success;
-
- dprintk("lockd: GRANTED_RES called\n");
-
- nlmsvc_grant_reply(&argp->cookie, argp->status);
- return rpc_success;
-}
-
static __be32
nlmsvc_proc_unused(struct svc_rqst *rqstp)
{
@@ -1310,15 +1318,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = XDR_void,
.pc_name = "UNLOCK_RES",
},
- [NLMPROC_GRANTED_RES] = {
- .pc_func = nlmsvc_proc_granted_res,
- .pc_decode = nlmsvc_decode_res,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct lockd_res),
- .pc_argzero = sizeof(struct lockd_res),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "GRANTED_RES",
+ [NLM_GRANTED_RES] = {
+ .pc_func = nlmsvc_proc_granted_res,
+ .pc_decode = nlm_svc_decode_nlm_res,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = sizeof(struct nlm_res_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "GRANTED_RES",
},
[NLMPROC_NSM_NOTIFY] = {
.pc_func = nlmsvc_proc_sm_notify,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 30/38] lockd: Use xdrgen XDR functions for the NLMv3 SM_NOTIFY procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (28 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 29/38] lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_RES procedure Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 31/38] lockd: Convert NLMv3 server-side undefined procedures to xdrgen Chuck Lever
` (8 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Continue the xdrgen migration by converting NLMv3 SM_NOTIFY,
a private callback from statd to notify lockd when a remote
host has rebooted. The procedure now uses
nlm_svc_decode_nlm_notifyargs and nlm_svc_encode_void,
generated from the NLM version 3 protocol specification.
A new struct nlm_notifyargs_wrapper bridges between the
xdrgen-generated nlm_notifyargs and the lockd_reboot
structure expected by nlm_host_rebooted(). The wrapper
contains both the xdrgen-decoded arguments and a reboot
field for the existing API.
Setting pc_argzero to zero is safe because the generated
decoder fills argp->xdrgen before the procedure runs, so
the zeroing memset performed by the dispatch layer is no
longer needed.
Setting pc_xdrressize to XDR_void reflects that SM_NOTIFY
returns no data; the previous value of St over-reserved a
status word in the reply buffer.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 86 ++++++++++++++++++++++++++++++++++--------------------
1 file changed, 55 insertions(+), 31 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index a2ac747e96ce..e0328dc89deb 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -80,6 +80,13 @@ struct nlm_unlockargs_wrapper {
static_assert(offsetof(struct nlm_unlockargs_wrapper, xdrgen) == 0);
+struct nlm_notifyargs_wrapper {
+ struct nlm_notifyargs xdrgen;
+ struct lockd_reboot reboot;
+};
+
+static_assert(offsetof(struct nlm_notifyargs_wrapper, xdrgen) == 0);
+
static __be32
nlm_netobj_to_cookie(struct lockd_cookie *cookie, netobj *object)
{
@@ -1022,6 +1029,44 @@ static __be32 nlmsvc_proc_granted_res(struct svc_rqst *rqstp)
return rpc_success;
}
+/**
+ * nlmsvc_proc_sm_notify - SM_NOTIFY: Peer has rebooted
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_system_err: RPC execution failed.
+ *
+ * The SM_NOTIFY procedure is a private callback from Linux statd and is
+ * not part of the official NLM protocol.
+ *
+ * RPC synopsis:
+ * void NLM_SM_NOTIFY(nlm_notifyargs) = 16;
+ */
+static __be32 nlmsvc_proc_sm_notify(struct svc_rqst *rqstp)
+{
+ struct nlm_notifyargs_wrapper *argp = rqstp->rq_argp;
+ struct lockd_reboot *reboot = &argp->reboot;
+
+ if (!nlm_privileged_requester(rqstp)) {
+ char buf[RPC_MAX_ADDRBUFLEN];
+
+ pr_warn("lockd: rejected NSM callback from %s\n",
+ svc_print_addr(rqstp, buf, sizeof(buf)));
+ return rpc_system_err;
+ }
+
+ reboot->len = argp->xdrgen.notify.name.len;
+ reboot->mon = (char *)argp->xdrgen.notify.name.data;
+ reboot->state = argp->xdrgen.notify.state;
+ memcpy(&reboot->priv.data, argp->xdrgen.private,
+ sizeof(reboot->priv.data));
+
+ nlm_host_rebooted(SVC_NET(rqstp), reboot);
+
+ return rpc_success;
+}
+
/*
* SHARE: create a DOS share or alter existing share.
*/
@@ -1129,27 +1174,6 @@ nlmsvc_proc_free_all(struct svc_rqst *rqstp)
return rpc_success;
}
-/*
- * SM_NOTIFY: private callback from statd (not part of official NLM proto)
- */
-static __be32
-nlmsvc_proc_sm_notify(struct svc_rqst *rqstp)
-{
- struct lockd_reboot *argp = rqstp->rq_argp;
-
- dprintk("lockd: SM_NOTIFY called\n");
-
- if (!nlm_privileged_requester(rqstp)) {
- char buf[RPC_MAX_ADDRBUFLEN];
- printk(KERN_WARNING "lockd: rejected NSM callback from %s\n",
- svc_print_addr(rqstp, buf, sizeof(buf)));
- return rpc_system_err;
- }
-
- nlm_host_rebooted(SVC_NET(rqstp), argp);
- return rpc_success;
-}
-
static __be32
nlmsvc_proc_unused(struct svc_rqst *rqstp)
{
@@ -1328,15 +1352,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = XDR_void,
.pc_name = "GRANTED_RES",
},
- [NLMPROC_NSM_NOTIFY] = {
- .pc_func = nlmsvc_proc_sm_notify,
- .pc_decode = nlmsvc_decode_reboot,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct lockd_reboot),
- .pc_argzero = sizeof(struct lockd_reboot),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "SM_NOTIFY",
+ [NLM_SM_NOTIFY] = {
+ .pc_func = nlmsvc_proc_sm_notify,
+ .pc_decode = nlm_svc_decode_nlm_notifyargs,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = sizeof(struct nlm_notifyargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "SM_NOTIFY",
},
[17] = {
.pc_func = nlmsvc_proc_unused,
@@ -1418,10 +1442,10 @@ union nlmsvc_xdrstore {
struct nlm_lockargs_wrapper lockargs;
struct nlm_cancargs_wrapper cancargs;
struct nlm_unlockargs_wrapper unlockargs;
+ struct nlm_notifyargs_wrapper notifyargs;
struct nlm_testres_wrapper testres;
struct nlm_res_wrapper res;
struct lockd_args args;
- struct lockd_reboot reboot;
};
/*
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 31/38] lockd: Convert NLMv3 server-side undefined procedures to xdrgen
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (29 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 30/38] lockd: Use xdrgen XDR functions for the NLMv3 SM_NOTIFY procedure Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 32/38] lockd: Use xdrgen XDR functions for the NLMv3 SHARE procedure Chuck Lever
` (7 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Complete the xdrgen migration of NLMv3 server-side
procedures by converting the three unused procedure slots
(17, 18, and 19). These slots already returned
rpc_proc_unavail; they are converted here only to retire
the last users of the hand-coded nlmsvc_decode_void and
nlmsvc_encode_void helpers.
The three undefined procedure entries now use the xdrgen
functions nlm_svc_decode_void and nlm_svc_encode_void. The
nlmsvc_proc_unused function is also moved earlier in the
file to follow the convention of placing procedure
implementations before the procedure table.
The pc_argsize, pc_ressize, and pc_argzero fields are now
set to zero since no arguments or results are processed.
Setting pc_xdrressize to XDR_void reflects that these
procedures return no reply payload; the previous value of
St over-reserved a status word in the reply buffer.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 66 +++++++++++++++++++++++++++++-------------------------
1 file changed, 36 insertions(+), 30 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index e0328dc89deb..79c410a75156 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -1067,6 +1067,18 @@ static __be32 nlmsvc_proc_sm_notify(struct svc_rqst *rqstp)
return rpc_success;
}
+/**
+ * nlmsvc_proc_unused - stub for unused procedures
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_proc_unavail: Program can't support procedure.
+ */
+static __be32 nlmsvc_proc_unused(struct svc_rqst *rqstp)
+{
+ return rpc_proc_unavail;
+}
+
/*
* SHARE: create a DOS share or alter existing share.
*/
@@ -1174,12 +1186,6 @@ nlmsvc_proc_free_all(struct svc_rqst *rqstp)
return rpc_success;
}
-static __be32
-nlmsvc_proc_unused(struct svc_rqst *rqstp)
-{
- return rpc_proc_unavail;
-}
-
/*
* NLM Server procedures.
*/
@@ -1363,34 +1369,34 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_name = "SM_NOTIFY",
},
[17] = {
- .pc_func = nlmsvc_proc_unused,
- .pc_decode = nlmsvc_decode_void,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_void),
- .pc_argzero = sizeof(struct nlm_void),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "UNUSED",
+ .pc_func = nlmsvc_proc_unused,
+ .pc_decode = nlm_svc_decode_void,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = 0,
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "UNUSED",
},
[18] = {
- .pc_func = nlmsvc_proc_unused,
- .pc_decode = nlmsvc_decode_void,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_void),
- .pc_argzero = sizeof(struct nlm_void),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "UNUSED",
+ .pc_func = nlmsvc_proc_unused,
+ .pc_decode = nlm_svc_decode_void,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = 0,
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "UNUSED",
},
[19] = {
- .pc_func = nlmsvc_proc_unused,
- .pc_decode = nlmsvc_decode_void,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct nlm_void),
- .pc_argzero = sizeof(struct nlm_void),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = St,
- .pc_name = "UNUSED",
+ .pc_func = nlmsvc_proc_unused,
+ .pc_decode = nlm_svc_decode_void,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = 0,
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "UNUSED",
},
[NLMPROC_SHARE] = {
.pc_func = nlmsvc_proc_share,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 32/38] lockd: Use xdrgen XDR functions for the NLMv3 SHARE procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (30 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 31/38] lockd: Convert NLMv3 server-side undefined procedures to xdrgen Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 33/38] lockd: Use xdrgen XDR functions for the NLMv3 UNSHARE procedure Chuck Lever
` (6 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Convert the NLMv3 SHARE procedure to use xdrgen-generated XDR
functions nlm_svc_decode_nlm_shareargs and
nlm_svc_encode_nlm_shareres.
This patch introduces struct nlm_shareargs_wrapper and struct
nlm_shareres_wrapper to bridge between the xdrgen-generated
structures and the internal lockd types. The procedure handler
is updated to access arguments through the argp->xdrgen
hierarchy and uses nlm3svc_lookup_host and nlm3svc_lookup_file
for host and file resolution.
The .pc_argzero field is set to zero because the generated
decoder fills argp->xdrgen before the procedure runs, so the
zeroing memset performed by the dispatch layer is no longer
needed.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 114 ++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 78 insertions(+), 36 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 79c410a75156..32625ee07c35 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -87,6 +87,19 @@ struct nlm_notifyargs_wrapper {
static_assert(offsetof(struct nlm_notifyargs_wrapper, xdrgen) == 0);
+struct nlm_shareargs_wrapper {
+ struct nlm_shareargs xdrgen;
+ struct lockd_lock lock;
+};
+
+static_assert(offsetof(struct nlm_shareargs_wrapper, xdrgen) == 0);
+
+struct nlm_shareres_wrapper {
+ struct nlm_shareres xdrgen;
+};
+
+static_assert(offsetof(struct nlm_shareres_wrapper, xdrgen) == 0);
+
static __be32
nlm_netobj_to_cookie(struct lockd_cookie *cookie, netobj *object)
{
@@ -1079,42 +1092,69 @@ static __be32 nlmsvc_proc_unused(struct svc_rqst *rqstp)
return rpc_proc_unavail;
}
-/*
- * SHARE: create a DOS share or alter existing share.
+/**
+ * nlmsvc_proc_share - SHARE: Open a file using DOS file-sharing modes
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_drop_reply: Do not send an RPC reply.
+ *
+ * RPC synopsis:
+ * nlm_shareres NLM_SHARE(nlm_shareargs) = 20;
+ *
+ * Permissible procedure status codes:
+ * %LCK_GRANTED: The requested share lock was granted.
+ * %LCK_DENIED: The requested lock conflicted with existing
+ * lock reservations for the file.
+ * %LCK_DENIED_GRACE_PERIOD: The server has recently restarted and is
+ * re-establishing existing locks, and is not
+ * yet ready to accept normal service requests.
+ *
+ * The Linux NLM server implementation also returns:
+ * %LCK_DENIED_NOLOCKS: A needed resource could not be allocated.
*/
-static __be32
-nlmsvc_proc_share(struct svc_rqst *rqstp)
+static __be32 nlmsvc_proc_share(struct svc_rqst *rqstp)
{
- struct lockd_args *argp = rqstp->rq_argp;
- struct lockd_res *resp = rqstp->rq_resp;
- struct nlm_host *host;
- struct nlm_file *file;
+ struct nlm_shareargs_wrapper *argp = rqstp->rq_argp;
+ struct nlm_shareres_wrapper *resp = rqstp->rq_resp;
+ struct lockd_lock *lock = &argp->lock;
+ struct nlm_host *host = NULL;
+ struct nlm_file *file = NULL;
+ struct nlm_lock xdr_lock = {
+ .fh = argp->xdrgen.share.fh,
+ .oh = argp->xdrgen.share.oh,
+ .uppid = LOCKD_SHARE_SVID,
+ };
- dprintk("lockd: SHARE called\n");
+ resp->xdrgen.cookie = argp->xdrgen.cookie;
- resp->cookie = argp->cookie;
+ resp->xdrgen.stat = nlm_lck_denied_grace_period;
+ if (locks_in_grace(SVC_NET(rqstp)) && !argp->xdrgen.reclaim)
+ goto out;
- /* Don't accept new lock requests during grace period */
- if (locks_in_grace(SVC_NET(rqstp)) && !argp->reclaim) {
- resp->status = nlm_lck_denied_grace_period;
- return rpc_success;
- }
+ resp->xdrgen.stat = nlm_lck_denied_nolocks;
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.share.caller_name, false);
+ if (!host)
+ goto out;
- /* Obtain client and file */
- if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
- return resp->status == nlm__int__drop_reply ?
- rpc_drop_reply : rpc_success;
+ resp->xdrgen.stat = nlm3svc_lookup_file(rqstp, host, lock, &file,
+ &xdr_lock, F_RDLCK);
+ if (resp->xdrgen.stat)
+ goto out;
- /* Now try to create the share */
- resp->status = cast_status(nlmsvc_share_file(host, file, &argp->lock.oh,
- argp->fsm_access,
- argp->fsm_mode));
+ resp->xdrgen.stat = nlmsvc_share_file(host, file, &lock->oh,
+ argp->xdrgen.share.access,
+ argp->xdrgen.share.mode);
- dprintk("lockd: SHARE status %d\n", ntohl(resp->status));
- nlmsvc_release_lockowner(&argp->lock);
+ nlmsvc_release_lockowner(lock);
+
+out:
+ if (file)
+ nlm_release_file(file);
nlmsvc_release_host(host);
- nlm_release_file(file);
- return rpc_success;
+ return resp->xdrgen.stat == nlm__int__drop_reply ?
+ rpc_drop_reply : rpc_success;
}
/*
@@ -1398,15 +1438,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = XDR_void,
.pc_name = "UNUSED",
},
- [NLMPROC_SHARE] = {
- .pc_func = nlmsvc_proc_share,
- .pc_decode = nlmsvc_decode_shareargs,
- .pc_encode = nlmsvc_encode_shareres,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct lockd_res),
- .pc_xdrressize = Ck+St+1,
- .pc_name = "SHARE",
+ [NLM_SHARE] = {
+ .pc_func = nlmsvc_proc_share,
+ .pc_decode = nlm_svc_decode_nlm_shareargs,
+ .pc_encode = nlm_svc_encode_nlm_shareres,
+ .pc_argsize = sizeof(struct nlm_shareargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = sizeof(struct nlm_shareres_wrapper),
+ .pc_xdrressize = NLM3_nlm_shareres_sz,
+ .pc_name = "SHARE",
},
[NLMPROC_UNSHARE] = {
.pc_func = nlmsvc_proc_unshare,
@@ -1449,8 +1489,10 @@ union nlmsvc_xdrstore {
struct nlm_cancargs_wrapper cancargs;
struct nlm_unlockargs_wrapper unlockargs;
struct nlm_notifyargs_wrapper notifyargs;
+ struct nlm_shareargs_wrapper shareargs;
struct nlm_testres_wrapper testres;
struct nlm_res_wrapper res;
+ struct nlm_shareres_wrapper shareres;
struct lockd_args args;
};
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 33/38] lockd: Use xdrgen XDR functions for the NLMv3 UNSHARE procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (31 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 32/38] lockd: Use xdrgen XDR functions for the NLMv3 SHARE procedure Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 34/38] lockd: Use xdrgen XDR functions for the NLMv3 NM_LOCK procedure Chuck Lever
` (5 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Convert the NLMv3 UNSHARE procedure to use xdrgen-generated XDR
functions nlm_svc_decode_nlm_shareargs and
nlm_svc_encode_nlm_shareres.
The procedure handler is updated to use the wrapper structures
(nlm_shareargs_wrapper and nlm_shareres_wrapper) introduced by
the SHARE conversion patch and accesses arguments through the
argp->xdrgen hierarchy.
The .pc_argzero field is set to zero because the generated
decoder fills argp->xdrgen before the procedure runs, so the
zeroing memset performed by the dispatch layer is no longer
needed.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 94 ++++++++++++++++++++++++++++++++++--------------------
1 file changed, 59 insertions(+), 35 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 32625ee07c35..de4c15aa725c 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -1157,41 +1157,65 @@ static __be32 nlmsvc_proc_share(struct svc_rqst *rqstp)
rpc_drop_reply : rpc_success;
}
-/*
- * UNSHARE: Release a DOS share.
+/**
+ * nlmsvc_proc_unshare - UNSHARE: Release a share reservation
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_drop_reply: Do not send an RPC reply.
+ *
+ * RPC synopsis:
+ * nlm_shareres NLM_UNSHARE(nlm_shareargs) = 21;
+ *
+ * Permissible procedure status codes:
+ * %LCK_GRANTED: The share reservation was released.
+ * %LCK_DENIED_GRACE_PERIOD: The server has recently restarted and is
+ * re-establishing existing locks, and is not
+ * yet ready to accept normal service requests.
+ *
+ * The Linux NLM server implementation also returns:
+ * %LCK_DENIED_NOLOCKS: A needed resource could not be allocated.
*/
-static __be32
-nlmsvc_proc_unshare(struct svc_rqst *rqstp)
+static __be32 nlmsvc_proc_unshare(struct svc_rqst *rqstp)
{
- struct lockd_args *argp = rqstp->rq_argp;
- struct lockd_res *resp = rqstp->rq_resp;
- struct nlm_host *host;
- struct nlm_file *file;
+ struct nlm_shareargs_wrapper *argp = rqstp->rq_argp;
+ struct nlm_shareres_wrapper *resp = rqstp->rq_resp;
+ struct lockd_lock *lock = &argp->lock;
+ struct nlm_lock xdr_lock = {
+ .fh = argp->xdrgen.share.fh,
+ .oh = argp->xdrgen.share.oh,
+ .uppid = LOCKD_SHARE_SVID,
+ };
+ struct nlm_host *host = NULL;
+ struct nlm_file *file = NULL;
- dprintk("lockd: UNSHARE called\n");
+ resp->xdrgen.cookie = argp->xdrgen.cookie;
- resp->cookie = argp->cookie;
+ resp->xdrgen.stat = nlm_lck_denied_grace_period;
+ if (locks_in_grace(SVC_NET(rqstp)))
+ goto out;
- /* Don't accept requests during grace period */
- if (locks_in_grace(SVC_NET(rqstp))) {
- resp->status = nlm_lck_denied_grace_period;
- return rpc_success;
- }
+ resp->xdrgen.stat = nlm_lck_denied_nolocks;
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.share.caller_name, false);
+ if (!host)
+ goto out;
- /* Obtain client and file */
- if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
- return resp->status == nlm__int__drop_reply ?
- rpc_drop_reply : rpc_success;
+ resp->xdrgen.stat = nlm3svc_lookup_file(rqstp, host, lock, &file,
+ &xdr_lock, F_RDLCK);
+ if (resp->xdrgen.stat)
+ goto out;
- /* Now try to unshare the file */
- resp->status = cast_status(nlmsvc_unshare_file(host, file,
- &argp->lock.oh));
+ resp->xdrgen.stat = nlmsvc_unshare_file(host, file, &lock->oh);
- dprintk("lockd: UNSHARE status %d\n", ntohl(resp->status));
- nlmsvc_release_lockowner(&argp->lock);
+ nlmsvc_release_lockowner(lock);
+
+out:
+ if (file)
+ nlm_release_file(file);
nlmsvc_release_host(host);
- nlm_release_file(file);
- return rpc_success;
+ return resp->xdrgen.stat == nlm__int__drop_reply ?
+ rpc_drop_reply : rpc_success;
}
/*
@@ -1448,15 +1472,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = NLM3_nlm_shareres_sz,
.pc_name = "SHARE",
},
- [NLMPROC_UNSHARE] = {
- .pc_func = nlmsvc_proc_unshare,
- .pc_decode = nlmsvc_decode_shareargs,
- .pc_encode = nlmsvc_encode_shareres,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct lockd_res),
- .pc_xdrressize = Ck+St+1,
- .pc_name = "UNSHARE",
+ [NLM_UNSHARE] = {
+ .pc_func = nlmsvc_proc_unshare,
+ .pc_decode = nlm_svc_decode_nlm_shareargs,
+ .pc_encode = nlm_svc_encode_nlm_shareres,
+ .pc_argsize = sizeof(struct nlm_shareargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = sizeof(struct nlm_shareres_wrapper),
+ .pc_xdrressize = NLM3_nlm_shareres_sz,
+ .pc_name = "UNSHARE",
},
[NLMPROC_NM_LOCK] = {
.pc_func = nlmsvc_proc_nm_lock,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 34/38] lockd: Use xdrgen XDR functions for the NLMv3 NM_LOCK procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (32 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 33/38] lockd: Use xdrgen XDR functions for the NLMv3 UNSHARE procedure Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 35/38] lockd: Use xdrgen XDR functions for the NLMv3 FREE_ALL procedure Chuck Lever
` (4 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
Now that nlmsvc_do_lock() has been introduced to handle both
monitored and non-monitored lock requests, the NLMv3 NM_LOCK
procedure can be converted to use xdrgen-generated XDR
functions. This conversion allows the removal of
__nlmsvc_proc_lock(), a helper function that was previously
shared between the LOCK and NM_LOCK procedures.
Replace the NLMPROC_NM_LOCK entry in the nlmsvc_procedures
array with an entry that uses xdrgen-built XDR decoders and
encoders. The procedure handler is reduced to a thin wrapper
around nlmsvc_do_lock() with the monitored flag set to false.
The pc_argzero=0 choice was justified for the LOCK conversion
and applies unchanged here, since both procedures share the
same nlm_lockargs_wrapper layout and decoder.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 86 ++++++++++++++++++++++--------------------------------
1 file changed, 35 insertions(+), 51 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index de4c15aa725c..4ca0eaef2966 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -392,38 +392,6 @@ static __be32 nlmsvc_proc_test(struct svc_rqst *rqstp)
rpc_drop_reply : rpc_success;
}
-static __be32
-__nlmsvc_proc_lock(struct svc_rqst *rqstp, struct lockd_res *resp)
-{
- struct lockd_args *argp = rqstp->rq_argp;
- struct nlm_host *host;
- struct nlm_file *file;
- __be32 rc = rpc_success;
-
- dprintk("lockd: LOCK called\n");
-
- resp->cookie = argp->cookie;
-
- /* Obtain client and file */
- if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
- 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__int__drop_reply)
- rc = rpc_drop_reply;
- else
- dprintk("lockd: LOCK status %d\n", ntohl(resp->status));
-
- nlmsvc_release_lockowner(&argp->lock);
- nlmsvc_release_host(host);
- nlm_release_file(file);
- return rc;
-}
-
static __be32
nlmsvc_do_lock(struct svc_rqst *rqstp, bool monitored)
{
@@ -1218,18 +1186,34 @@ static __be32 nlmsvc_proc_unshare(struct svc_rqst *rqstp)
rpc_drop_reply : rpc_success;
}
-/*
- * NM_LOCK: Create an unmonitored lock
+/**
+ * nlmsvc_proc_nm_lock - NM_LOCK: Establish a non-monitored lock
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ * %rpc_drop_reply: Do not send an RPC reply.
+ *
+ * RPC synopsis:
+ * nlm_res NLM_NM_LOCK(nlm_lockargs) = 22;
+ *
+ * Permissible procedure status codes:
+ * %LCK_GRANTED: The requested lock was granted.
+ * %LCK_DENIED: The requested lock conflicted with existing
+ * lock reservations for the file.
+ * %LCK_DENIED_NOLOCKS: The server could not allocate the resources
+ * needed to process the request.
+ * %LCK_BLOCKED: The blocking request cannot be granted
+ * immediately. The server will send an
+ * NLM_GRANTED callback to the client when
+ * the lock can be granted.
+ * %LCK_DENIED_GRACE_PERIOD: The server has recently restarted and is
+ * re-establishing existing locks, and is not
+ * yet ready to accept normal service requests.
*/
-static __be32
-nlmsvc_proc_nm_lock(struct svc_rqst *rqstp)
+static __be32 nlmsvc_proc_nm_lock(struct svc_rqst *rqstp)
{
- struct lockd_args *argp = rqstp->rq_argp;
-
- dprintk("lockd: NM_LOCK called\n");
-
- argp->monitor = 0; /* just clean the monitor flag */
- return __nlmsvc_proc_lock(rqstp, rqstp->rq_resp);
+ return nlmsvc_do_lock(rqstp, false);
}
/*
@@ -1482,15 +1466,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = NLM3_nlm_shareres_sz,
.pc_name = "UNSHARE",
},
- [NLMPROC_NM_LOCK] = {
- .pc_func = nlmsvc_proc_nm_lock,
- .pc_decode = nlmsvc_decode_lockargs,
- .pc_encode = nlmsvc_encode_res,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct lockd_res),
- .pc_xdrressize = Ck+St,
- .pc_name = "NM_LOCK",
+ [NLM_NM_LOCK] = {
+ .pc_func = nlmsvc_proc_nm_lock,
+ .pc_decode = nlm_svc_decode_nlm_lockargs,
+ .pc_encode = nlm_svc_encode_nlm_res,
+ .pc_argsize = sizeof(struct nlm_lockargs_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = sizeof(struct nlm_res_wrapper),
+ .pc_xdrressize = NLM3_nlm_res_sz,
+ .pc_name = "NM_LOCK",
},
[NLMPROC_FREE_ALL] = {
.pc_func = nlmsvc_proc_free_all,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 35/38] lockd: Use xdrgen XDR functions for the NLMv3 FREE_ALL procedure
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (33 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 34/38] lockd: Use xdrgen XDR functions for the NLMv3 NM_LOCK procedure Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 36/38] lockd: Remove C macros that are no longer used Chuck Lever
` (3 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
With all other NLMv3 procedures now converted to xdrgen-generated
XDR functions, the FREE_ALL procedure can be converted as well.
This conversion allows the removal of nlmsvc_retrieve_args(),
a 52-line helper function that was used only by FREE_ALL to
retrieve client information from lockd's internal data
structures.
Replace the NLMPROC_FREE_ALL entry in the nlmsvc_procedures
array with an entry that uses xdrgen-built XDR decoders and
encoders. The procedure handler is updated to use the new
wrapper structure (nlm_notify_wrapper) and call
nlm3svc_lookup_host() directly, eliminating the need for the
now-removed helper function.
Setting pc_argzero to zero is safe because the generated decoder
fills the argp->xdrgen subfields before the procedure runs, so the
zeroing memset performed by the dispatch layer is not needed. The
nlm_notify_wrapper structure has no members beyond the xdrgen
substructure, so no further initialization is required.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 113 ++++++++++++++++-------------------------------------
1 file changed, 33 insertions(+), 80 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 4ca0eaef2966..ef1ae701b43b 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -100,6 +100,12 @@ struct nlm_shareres_wrapper {
static_assert(offsetof(struct nlm_shareres_wrapper, xdrgen) == 0);
+struct nlm_notify_wrapper {
+ struct nlm_notify xdrgen;
+};
+
+static_assert(offsetof(struct nlm_notify_wrapper, xdrgen) == 0);
+
static __be32
nlm_netobj_to_cookie(struct lockd_cookie *cookie, netobj *object)
{
@@ -240,68 +246,6 @@ static inline __be32 cast_status(__be32 status)
}
#endif
-/*
- * Obtain client and file from arguments
- */
-static __be32
-nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct lockd_args *argp,
- struct nlm_host **hostp, struct nlm_file **filp)
-{
- struct nlm_host *host = NULL;
- struct nlm_file *file = NULL;
- struct lockd_lock *lock = &argp->lock;
- bool is_test = (rqstp->rq_proc == NLMPROC_TEST ||
- rqstp->rq_proc == NLMPROC_TEST_MSG);
- int mode;
- __be32 error = 0;
-
- /* nfsd callbacks must have been installed for this procedure */
- if (!nlmsvc_ops)
- return nlm_lck_denied_nolocks;
-
- /* Obtain host handle */
- if (!(host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len))
- || (argp->monitor && nsm_monitor(host) < 0))
- goto no_locks;
- *hostp = host;
-
- /* Obtain file pointer. Not used by FREE_ALL call. */
- if (filp != NULL) {
- mode = lock_to_openmode(&lock->fl);
-
- if (is_test)
- mode = O_RDWR;
-
- error = cast_status(nlm_lookup_file(rqstp, &file, lock, mode));
- if (error != 0)
- goto no_locks;
- *filp = file;
-
- /* Set up the missing parts of the file_lock structure */
- lock->fl.c.flc_flags = FL_POSIX;
- if (is_test)
- lock->fl.c.flc_file = nlmsvc_file_file(file);
- else
- lock->fl.c.flc_file = file->f_file[mode];
- lock->fl.c.flc_pid = current->tgid;
- lock->fl.fl_lmops = &nlmsvc_lock_operations;
- nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);
- if (!lock->fl.c.flc_owner) {
- /* lockowner allocation has failed */
- nlmsvc_release_host(host);
- return nlm_lck_denied_nolocks;
- }
- }
-
- return 0;
-
-no_locks:
- nlmsvc_release_host(host);
- if (error)
- return error;
- return nlm_lck_denied_nolocks;
-}
-
/**
* nlmsvc_proc_null - NULL: Test for presence of service
* @rqstp: RPC transaction context
@@ -1216,21 +1160,30 @@ static __be32 nlmsvc_proc_nm_lock(struct svc_rqst *rqstp)
return nlmsvc_do_lock(rqstp, false);
}
-/*
- * FREE_ALL: Release all locks and shares held by client
+/**
+ * nlmsvc_proc_free_all - FREE_ALL: Discard client's lock and share state
+ * @rqstp: RPC transaction context
+ *
+ * Returns:
+ * %rpc_success: RPC executed successfully.
+ *
+ * RPC synopsis:
+ * void NLMPROC_FREE_ALL(nlm_notify) = 23;
*/
-static __be32
-nlmsvc_proc_free_all(struct svc_rqst *rqstp)
+static __be32 nlmsvc_proc_free_all(struct svc_rqst *rqstp)
{
- struct lockd_args *argp = rqstp->rq_argp;
+ struct nlm_notify_wrapper *argp = rqstp->rq_argp;
struct nlm_host *host;
- /* Obtain client */
- if (nlmsvc_retrieve_args(rqstp, argp, &host, NULL))
- return rpc_success;
+ host = nlm3svc_lookup_host(rqstp, argp->xdrgen.name, false);
+ if (!host)
+ goto out;
nlmsvc_free_host_resources(host);
+
nlmsvc_release_host(host);
+
+out:
return rpc_success;
}
@@ -1476,15 +1429,15 @@ static const struct svc_procedure nlmsvc_procedures[24] = {
.pc_xdrressize = NLM3_nlm_res_sz,
.pc_name = "NM_LOCK",
},
- [NLMPROC_FREE_ALL] = {
- .pc_func = nlmsvc_proc_free_all,
- .pc_decode = nlmsvc_decode_notify,
- .pc_encode = nlmsvc_encode_void,
- .pc_argsize = sizeof(struct lockd_args),
- .pc_argzero = sizeof(struct lockd_args),
- .pc_ressize = sizeof(struct nlm_void),
- .pc_xdrressize = 0,
- .pc_name = "FREE_ALL",
+ [NLM_FREE_ALL] = {
+ .pc_func = nlmsvc_proc_free_all,
+ .pc_decode = nlm_svc_decode_nlm_notify,
+ .pc_encode = nlm_svc_encode_void,
+ .pc_argsize = sizeof(struct nlm_notify_wrapper),
+ .pc_argzero = 0,
+ .pc_ressize = 0,
+ .pc_xdrressize = XDR_void,
+ .pc_name = "FREE_ALL",
},
};
@@ -1498,10 +1451,10 @@ union nlmsvc_xdrstore {
struct nlm_unlockargs_wrapper unlockargs;
struct nlm_notifyargs_wrapper notifyargs;
struct nlm_shareargs_wrapper shareargs;
+ struct nlm_notify_wrapper notify;
struct nlm_testres_wrapper testres;
struct nlm_res_wrapper res;
struct nlm_shareres_wrapper shareres;
- struct lockd_args args;
};
/*
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 36/38] lockd: Remove C macros that are no longer used
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (34 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 35/38] lockd: Use xdrgen XDR functions for the NLMv3 FREE_ALL procedure Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 37/38] lockd: Remove dead code from fs/lockd/xdr.c Chuck Lever
` (2 subsequent siblings)
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
The conversion of all NLMv3 procedures to xdrgen-generated
XDR functions is complete. The hand-rolled XDR size
calculation macros (Ck, No, St, Rg) and the nlm_void
structure definition served only the older implementations
and are now unused.
Also removes NLMDBG_FACILITY, which was set to the client
debug flag in server-side code but never referenced, and
corrects a comment to specify "NLMv3 Server procedures".
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index ef1ae701b43b..f62b0b39c5e9 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -24,8 +24,6 @@
#include "share.h"
#include "nlm3xdr_gen.h"
-#define NLMDBG_FACILITY NLMDBG_CLIENT
-
/*
* Size of an NFSv2 file handle, in bytes, which is 32.
* Defined locally to avoid including uapi/linux/nfs2.h.
@@ -1188,16 +1186,9 @@ static __be32 nlmsvc_proc_free_all(struct svc_rqst *rqstp)
}
/*
- * NLM Server procedures.
+ * NLMv3 Server procedures.
*/
-struct nlm_void { int dummy; };
-
-#define Ck (1+XDR_QUADLEN(NLM_MAXCOOKIELEN)) /* cookie */
-#define St 1 /* status */
-#define No (1+1024/4) /* Net Obj */
-#define Rg 2 /* range - offset + size */
-
static const struct svc_procedure nlmsvc_procedures[24] = {
[NLM_NULL] = {
.pc_func = nlmsvc_proc_null,
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 37/38] lockd: Remove dead code from fs/lockd/xdr.c
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (35 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 36/38] lockd: Remove C macros that are no longer used Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-12 18:14 ` [PATCH 38/38] lockd: Unify cast_status Chuck Lever
2026-05-14 16:52 ` [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Jeff Layton
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
All NLMv3 server-side procedures now dispatch through
xdrgen-generated encoder and decoder functions, leaving the
hand-written XDR processing in fs/lockd/xdr.c with no remaining
callers.
Remove fs/lockd/xdr.c, the fs/lockd/svcxdr.h header it included,
the Makefile entry, and the now-unused nlmsvc_decode_* /
nlmsvc_encode_* prototypes from fs/lockd/xdr.h. The structure
definitions and status code macros in xdr.h are retained as they
are still used by the client-side code.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/Makefile | 2 +-
fs/lockd/svcxdr.h | 142 ----------------------
fs/lockd/xdr.c | 354 ------------------------------------------------------
fs/lockd/xdr.h | 20 ---
4 files changed, 1 insertion(+), 517 deletions(-)
diff --git a/fs/lockd/Makefile b/fs/lockd/Makefile
index 951a74e4847a..3f9569d3ba0e 100644
--- a/fs/lockd/Makefile
+++ b/fs/lockd/Makefile
@@ -8,7 +8,7 @@ ccflags-y += -I$(src) # needed for trace events
obj-$(CONFIG_LOCKD) += lockd.o
lockd-y := clntlock.o clntproc.o clntxdr.o host.o svc.o svclock.o \
- svcshare.o svcproc.o svcsubs.o mon.o trace.o xdr.o netlink.o \
+ svcshare.o svcproc.o svcsubs.o mon.o trace.o netlink.o \
nlm3xdr_gen.o
lockd-$(CONFIG_LOCKD_V4) += clnt4xdr.o svc4proc.o nlm4xdr_gen.o
lockd-$(CONFIG_PROC_FS) += procfs.o
diff --git a/fs/lockd/svcxdr.h b/fs/lockd/svcxdr.h
deleted file mode 100644
index 911b5fd707b1..000000000000
--- a/fs/lockd/svcxdr.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Encode/decode NLM basic data types
- *
- * Basic NLMv3 XDR data types are not defined in an IETF standards
- * document. X/Open has a description of these data types that
- * is useful. See Chapter 10 of "Protocols for Interworking:
- * XNFS, Version 3W".
- *
- * Basic NLMv4 XDR data types are defined in Appendix II.1.4 of
- * RFC 1813: "NFS Version 3 Protocol Specification".
- *
- * Author: Chuck Lever <chuck.lever@oracle.com>
- *
- * Copyright (c) 2020, Oracle and/or its affiliates.
- */
-
-#ifndef _LOCKD_SVCXDR_H_
-#define _LOCKD_SVCXDR_H_
-
-static inline bool
-svcxdr_decode_stats(struct xdr_stream *xdr, __be32 *status)
-{
- __be32 *p;
-
- p = xdr_inline_decode(xdr, XDR_UNIT);
- if (!p)
- return false;
- *status = *p;
-
- return true;
-}
-
-static inline bool
-svcxdr_encode_stats(struct xdr_stream *xdr, __be32 status)
-{
- __be32 *p;
-
- p = xdr_reserve_space(xdr, XDR_UNIT);
- if (!p)
- return false;
- *p = status;
-
- return true;
-}
-
-static inline bool
-svcxdr_decode_string(struct xdr_stream *xdr, char **data, unsigned int *data_len)
-{
- __be32 *p;
- u32 len;
-
- if (xdr_stream_decode_u32(xdr, &len) < 0)
- return false;
- if (len > NLM_MAXSTRLEN)
- return false;
- p = xdr_inline_decode(xdr, len);
- if (!p)
- return false;
- *data_len = len;
- *data = (char *)p;
-
- return true;
-}
-
-/*
- * NLM cookies are defined by specification to be a variable-length
- * XDR opaque no longer than 1024 bytes. However, this implementation
- * limits their length to 32 bytes, and treats zero-length cookies
- * specially.
- */
-static inline bool
-svcxdr_decode_cookie(struct xdr_stream *xdr, struct lockd_cookie *cookie)
-{
- __be32 *p;
- u32 len;
-
- if (xdr_stream_decode_u32(xdr, &len) < 0)
- return false;
- if (len > NLM_MAXCOOKIELEN)
- return false;
- if (!len)
- goto out_hpux;
-
- p = xdr_inline_decode(xdr, len);
- if (!p)
- return false;
- cookie->len = len;
- memcpy(cookie->data, p, len);
-
- return true;
-
- /* apparently HPUX can return empty cookies */
-out_hpux:
- cookie->len = 4;
- memset(cookie->data, 0, 4);
- return true;
-}
-
-static inline bool
-svcxdr_encode_cookie(struct xdr_stream *xdr, const struct lockd_cookie *cookie)
-{
- __be32 *p;
-
- if (xdr_stream_encode_u32(xdr, cookie->len) < 0)
- return false;
- p = xdr_reserve_space(xdr, cookie->len);
- if (!p)
- return false;
- memcpy(p, cookie->data, cookie->len);
-
- return true;
-}
-
-static inline bool
-svcxdr_decode_owner(struct xdr_stream *xdr, struct xdr_netobj *obj)
-{
- __be32 *p;
- u32 len;
-
- if (xdr_stream_decode_u32(xdr, &len) < 0)
- return false;
- if (len > XDR_MAX_NETOBJ)
- return false;
- p = xdr_inline_decode(xdr, len);
- if (!p)
- return false;
- obj->len = len;
- obj->data = (u8 *)p;
-
- return true;
-}
-
-static inline bool
-svcxdr_encode_owner(struct xdr_stream *xdr, const struct xdr_netobj *obj)
-{
- if (obj->len > XDR_MAX_NETOBJ)
- return false;
- return xdr_stream_encode_opaque(xdr, obj->data, obj->len) > 0;
-}
-
-#endif /* _LOCKD_SVCXDR_H_ */
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
deleted file mode 100644
index c78c64557fea..000000000000
--- a/fs/lockd/xdr.c
+++ /dev/null
@@ -1,354 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * linux/fs/lockd/xdr.c
- *
- * XDR support for lockd and the lock client.
- *
- * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
- */
-
-#include <linux/types.h>
-#include <linux/sched.h>
-#include <linux/nfs.h>
-
-#include <linux/sunrpc/xdr.h>
-#include <linux/sunrpc/clnt.h>
-#include <linux/sunrpc/svc.h>
-#include <linux/sunrpc/stats.h>
-
-#include <uapi/linux/nfs2.h>
-
-#include "lockd.h"
-#include "share.h"
-#include "svcxdr.h"
-
-static inline loff_t
-s32_to_loff_t(__s32 offset)
-{
- return (loff_t)offset;
-}
-
-static inline __s32
-loff_t_to_s32(loff_t offset)
-{
- __s32 res;
- if (offset >= NLM_OFFSET_MAX)
- res = NLM_OFFSET_MAX;
- else if (offset <= -NLM_OFFSET_MAX)
- res = -NLM_OFFSET_MAX;
- else
- res = offset;
- return res;
-}
-
-/*
- * NLM file handles are defined by specification to be a variable-length
- * XDR opaque no longer than 1024 bytes. However, this implementation
- * constrains their length to exactly the length of an NFSv2 file
- * handle.
- */
-static bool
-svcxdr_decode_fhandle(struct xdr_stream *xdr, struct nfs_fh *fh)
-{
- __be32 *p;
- u32 len;
-
- if (xdr_stream_decode_u32(xdr, &len) < 0)
- return false;
- if (len != NFS2_FHSIZE)
- return false;
-
- p = xdr_inline_decode(xdr, len);
- if (!p)
- return false;
- fh->size = NFS2_FHSIZE;
- memcpy(fh->data, p, len);
- memset(fh->data + NFS2_FHSIZE, 0, sizeof(fh->data) - NFS2_FHSIZE);
-
- return true;
-}
-
-static bool
-svcxdr_decode_lock(struct xdr_stream *xdr, struct lockd_lock *lock)
-{
- struct file_lock *fl = &lock->fl;
- s32 start, len, end;
-
- if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len))
- return false;
- if (!svcxdr_decode_fhandle(xdr, &lock->fh))
- return false;
- if (!svcxdr_decode_owner(xdr, &lock->oh))
- return false;
- if (xdr_stream_decode_u32(xdr, &lock->svid) < 0)
- return false;
- if (xdr_stream_decode_u32(xdr, &start) < 0)
- return false;
- if (xdr_stream_decode_u32(xdr, &len) < 0)
- return false;
-
- locks_init_lock(fl);
- fl->c.flc_flags = FL_POSIX;
- fl->c.flc_type = F_RDLCK;
- end = start + len - 1;
- fl->fl_start = s32_to_loff_t(start);
- if (len == 0 || end < 0)
- fl->fl_end = OFFSET_MAX;
- else
- fl->fl_end = s32_to_loff_t(end);
-
- return true;
-}
-
-static bool
-svcxdr_encode_holder(struct xdr_stream *xdr, const struct lockd_lock *lock)
-{
- const struct file_lock *fl = &lock->fl;
- s32 start, len;
-
- /* exclusive */
- if (xdr_stream_encode_bool(xdr, fl->c.flc_type != F_RDLCK) < 0)
- return false;
- if (xdr_stream_encode_u32(xdr, lock->svid) < 0)
- return false;
- if (!svcxdr_encode_owner(xdr, &lock->oh))
- return false;
- start = loff_t_to_s32(fl->fl_start);
- if (fl->fl_end == OFFSET_MAX)
- len = 0;
- else
- len = loff_t_to_s32(fl->fl_end - fl->fl_start + 1);
- if (xdr_stream_encode_u32(xdr, start) < 0)
- return false;
- if (xdr_stream_encode_u32(xdr, len) < 0)
- return false;
-
- return true;
-}
-
-static bool
-svcxdr_encode_testrply(struct xdr_stream *xdr, const struct lockd_res *resp)
-{
- if (!svcxdr_encode_stats(xdr, resp->status))
- return false;
- switch (resp->status) {
- case nlm_lck_denied:
- if (!svcxdr_encode_holder(xdr, &resp->lock))
- return false;
- }
-
- return true;
-}
-
-
-/*
- * Decode Call arguments
- */
-
-bool
-nlmsvc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- return true;
-}
-
-bool
-nlmsvc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- struct lockd_args *argp = rqstp->rq_argp;
- u32 exclusive;
-
- if (!svcxdr_decode_cookie(xdr, &argp->cookie))
- return false;
- if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
- return false;
- if (!svcxdr_decode_lock(xdr, &argp->lock))
- return false;
- if (exclusive)
- argp->lock.fl.c.flc_type = F_WRLCK;
-
- return true;
-}
-
-bool
-nlmsvc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- struct lockd_args *argp = rqstp->rq_argp;
- u32 exclusive;
-
- if (!svcxdr_decode_cookie(xdr, &argp->cookie))
- return false;
- if (xdr_stream_decode_bool(xdr, &argp->block) < 0)
- return false;
- if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
- return false;
- if (!svcxdr_decode_lock(xdr, &argp->lock))
- return false;
- if (exclusive)
- argp->lock.fl.c.flc_type = F_WRLCK;
- if (xdr_stream_decode_bool(xdr, &argp->reclaim) < 0)
- return false;
- if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
- return false;
- argp->monitor = 1; /* monitor client by default */
-
- return true;
-}
-
-bool
-nlmsvc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- struct lockd_args *argp = rqstp->rq_argp;
- u32 exclusive;
-
- if (!svcxdr_decode_cookie(xdr, &argp->cookie))
- return false;
- if (xdr_stream_decode_bool(xdr, &argp->block) < 0)
- return false;
- if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
- return false;
- if (!svcxdr_decode_lock(xdr, &argp->lock))
- return false;
- if (exclusive)
- argp->lock.fl.c.flc_type = F_WRLCK;
-
- return true;
-}
-
-bool
-nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- struct lockd_args *argp = rqstp->rq_argp;
-
- if (!svcxdr_decode_cookie(xdr, &argp->cookie))
- return false;
- if (!svcxdr_decode_lock(xdr, &argp->lock))
- return false;
- argp->lock.fl.c.flc_type = F_UNLCK;
-
- return true;
-}
-
-bool
-nlmsvc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- struct lockd_res *resp = rqstp->rq_argp;
-
- if (!svcxdr_decode_cookie(xdr, &resp->cookie))
- return false;
- if (!svcxdr_decode_stats(xdr, &resp->status))
- return false;
-
- return true;
-}
-
-bool
-nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- struct lockd_reboot *argp = rqstp->rq_argp;
- __be32 *p;
- u32 len;
-
- if (xdr_stream_decode_u32(xdr, &len) < 0)
- return false;
- if (len > SM_MAXSTRLEN)
- return false;
- p = xdr_inline_decode(xdr, len);
- if (!p)
- return false;
- argp->len = len;
- argp->mon = (char *)p;
- if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
- return false;
- p = xdr_inline_decode(xdr, SM_PRIV_SIZE);
- if (!p)
- return false;
- memcpy(&argp->priv.data, p, sizeof(argp->priv.data));
-
- return true;
-}
-
-bool
-nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- struct lockd_args *argp = rqstp->rq_argp;
- struct lockd_lock *lock = &argp->lock;
-
- memset(lock, 0, sizeof(*lock));
- locks_init_lock(&lock->fl);
- lock->svid = LOCKD_SHARE_SVID;
-
- if (!svcxdr_decode_cookie(xdr, &argp->cookie))
- return false;
- if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len))
- return false;
- if (!svcxdr_decode_fhandle(xdr, &lock->fh))
- return false;
- if (!svcxdr_decode_owner(xdr, &lock->oh))
- return false;
- /* XXX: Range checks are missing in the original code */
- if (xdr_stream_decode_u32(xdr, &argp->fsm_mode) < 0)
- return false;
- if (xdr_stream_decode_u32(xdr, &argp->fsm_access) < 0)
- return false;
-
- return true;
-}
-
-bool
-nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- struct lockd_args *argp = rqstp->rq_argp;
- struct lockd_lock *lock = &argp->lock;
-
- if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len))
- return false;
- if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
- return false;
-
- return true;
-}
-
-
-/*
- * Encode Reply results
- */
-
-bool
-nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- return true;
-}
-
-bool
-nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- struct lockd_res *resp = rqstp->rq_resp;
-
- return svcxdr_encode_cookie(xdr, &resp->cookie) &&
- svcxdr_encode_testrply(xdr, resp);
-}
-
-bool
-nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- struct lockd_res *resp = rqstp->rq_resp;
-
- return svcxdr_encode_cookie(xdr, &resp->cookie) &&
- svcxdr_encode_stats(xdr, resp->status);
-}
-
-bool
-nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
-{
- struct lockd_res *resp = rqstp->rq_resp;
-
- if (!svcxdr_encode_cookie(xdr, &resp->cookie))
- return false;
- if (!svcxdr_encode_stats(xdr, resp->status))
- return false;
- /* sequence */
- if (xdr_stream_encode_u32(xdr, 0) < 0)
- return false;
-
- return true;
-}
diff --git a/fs/lockd/xdr.h b/fs/lockd/xdr.h
index 65d2d6d34310..a1126cca98c6 100644
--- a/fs/lockd/xdr.h
+++ b/fs/lockd/xdr.h
@@ -20,8 +20,6 @@ struct nsm_private {
unsigned char data[SM_PRIV_SIZE];
};
-struct svc_rqst;
-
#define NLM_MAXCOOKIELEN 32
#define NLM_MAXSTRLEN 1024
@@ -63,9 +61,6 @@ struct lockd_args {
u32 block;
u32 reclaim;
u32 state;
- u32 monitor;
- u32 fsm_access;
- u32 fsm_mode;
};
/*
@@ -87,19 +82,4 @@ struct lockd_reboot {
struct nsm_private priv;
};
-bool nlmsvc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-bool nlmsvc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-bool nlmsvc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-bool nlmsvc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-bool nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-bool nlmsvc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-bool nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-bool nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-bool nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-
-bool nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-bool nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-bool nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-bool nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
-
#endif /* _LOCKD_XDR_H */
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 38/38] lockd: Unify cast_status
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (36 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 37/38] lockd: Remove dead code from fs/lockd/xdr.c Chuck Lever
@ 2026-05-12 18:14 ` Chuck Lever
2026-05-14 16:52 ` [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Jeff Layton
38 siblings, 0 replies; 42+ messages in thread
From: Chuck Lever @ 2026-05-12 18:14 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
From: Chuck Lever <chuck.lever@oracle.com>
cast_status folds internal lock-daemon sentinels into NLMv1/v3
wire status codes for the v3 reply path. Two variants have
existed since the original kernel import: a strict allowlist
under CONFIG_LOCKD_V4 and a sentinel-translation form for the
!CONFIG_LOCKD_V4 build. The split was never grounded in a
behavioural difference -- nlmsvc_testlock and nlmsvc_lock,
which feed cast_status, return the same set of values in both
configurations -- and recent xdrgen conversions have narrowed
the caller set further: nlm__int__stale_fh and nlm__int__failed
are now translated at their point of origin in nlm3svc_lookup_file,
and the cast_status wraps around nlmsvc_cancel_blocked and
nlmsvc_unlock have been dropped because those functions return
only wire codes.
Collapse the two variants into one. The unified form keeps the
CONFIG_LOCKD_V4 arm's allowlist, retains the nlm__int__deadlock
translation, and folds anything else to nlm_lck_denied_nolocks
after a pr_warn_once so an unexpected sentinel from a future
refactor remains visible in the kernel log instead of being
silently passed to the wire encoder.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/svcproc.c | 23 ++---------------------
1 file changed, 2 insertions(+), 21 deletions(-)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index f62b0b39c5e9..4836887f11ef 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -203,7 +203,6 @@ nlm3svc_lookup_file(struct svc_rqst *rqstp, struct nlm_host *host,
return nlm_granted;
}
-#ifdef CONFIG_LOCKD_V4
static inline __be32 cast_status(__be32 status)
{
switch (status) {
@@ -218,31 +217,13 @@ static inline __be32 cast_status(__be32 status)
status = nlm_lck_denied;
break;
default:
+ pr_warn_once("lockd: unhandled internal status %u\n",
+ be32_to_cpu(status));
status = nlm_lck_denied_nolocks;
- }
-
- return status;
-}
-#else
-static inline __be32 cast_status(__be32 status)
-{
- switch (status) {
- case nlm__int__deadlock:
- status = nlm_lck_denied;
- break;
- case nlm__int__stale_fh:
- case nlm__int__failed:
- status = nlm_lck_denied_nolocks;
- break;
- default:
- if (be32_to_cpu(status) > be32_to_cpu(nlm__int__drop_reply))
- pr_warn_once("lockd: unhandled internal status %u\n",
- be32_to_cpu(status));
break;
}
return status;
}
-#endif
/**
* nlmsvc_proc_null - NULL: Test for presence of service
--
2.54.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
` (37 preceding siblings ...)
2026-05-12 18:14 ` [PATCH 38/38] lockd: Unify cast_status Chuck Lever
@ 2026-05-14 16:52 ` Jeff Layton
2026-05-14 17:53 ` Chuck Lever
38 siblings, 1 reply; 42+ messages in thread
From: Jeff Layton @ 2026-05-14 16:52 UTC (permalink / raw)
To: Chuck Lever, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
On Tue, 2026-05-12 at 14:13 -0400, Chuck Lever wrote:
> This series finishes the xdrgen migration of lockd's server-side
> stack. The companion NLMv4 work landed earlier; here the
> remaining hand-written XDR in fs/lockd/xdr.c is retired in
> favour of code generated from a new
> Documentation/sunrpc/xdr/nlm3.x.
>
> XDR helpers now do wire-format conversion only. NLMv3's
> 32-bit range limit on TEST conflict-holder byte ranges is
> clamped at the proc function rather than inside loff_t_to_s32()
> in the encoder. The HP-UX zero-length cookie rewrite that
> svcxdr_decode_cookie() has carried since the original kernel
> import is dropped on the server side; the generated decoder
> reproduces the cookie verbatim, and neither NLM_TEST reply
> matching nor CANCEL_MSG depends on the substitution.
>
> A wrapper struct bridges each generated argument type with
> lockd's legacy lockd_lock/lockd_cookie/lockd_res internals.
> Each handler reaches xdrgen-decoded fields through argp->xdrgen
> and the legacy layout through a wrapper member that the handler
> populates explicitly, typically in nlm3svc_lookup_file(). The
> core lockd helpers and the async callback path operate on the
> legacy types unchanged, which is what keeps the conversion
> incremental.
>
> .pc_argzero is cleared for every converted procedure: the
> generated decoders fill the substructure they own, so the
> dispatch layer's zero-memset is no longer needed. The
> trade-off is that any wrapper field a handler reads must be
> initialized explicitly. lock members are populated by
> nlm3svc_lookup_file(), or on the GRANTED path by the new
> nlm_lock_to_lockd_lock() helper.
>
> Five NLMv4 fixes at the head of the series and three cleanup
> patches at the tail bracket the conversion. The six lockd_
> struct renames between them are split out so that each
> conversion patch reads as a single concern.
>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>
> ---
> Chuck Lever (38):
> lockd: Stop warning on nlm__int__drop_reply in !V4 cast_status
> lockd: Correct kernel-doc status descriptions for NLMv4 GRANTED
> lockd: Drop locks_init_lock() from nlm4_lock_to_lockd_lock()
> lockd: Translate nlm__int__deadlock in __nlm4svc_proc_lock_msg()
> lockd: Do not monitor when looking up the LOCK_MSG callback host
> Documentation: Add the RPC language description of NLM version 3
> lockd: Rename struct nlm_cookie to lockd_cookie
> lockd: Rename struct nlm_lock to lockd_lock
> lockd: Rename struct nlm_args to lockd_args
> lockd: Rename struct nlm_res to lockd_res
> lockd: Rename struct nlm_reboot to lockd_reboot
> lockd: Rename struct nlm_share to lockd_share
> lockd: Use xdrgen XDR functions for the NLMv3 NULL procedure
> lockd: Use xdrgen XDR functions for the NLMv3 TEST procedure
> lockd: Use xdrgen XDR functions for the NLMv3 LOCK procedure
> lockd: Use xdrgen XDR functions for the NLMv3 CANCEL procedure
> lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK procedure
> lockd: Use xdrgen XDR functions for the NLMv3 GRANTED procedure
> lockd: Refactor nlmsvc_callback()
> lockd: Use xdrgen XDR functions for the NLMv3 TEST_MSG procedure
> lockd: Use xdrgen XDR functions for the NLMv3 LOCK_MSG procedure
> lockd: Use xdrgen XDR functions for the NLMv3 CANCEL_MSG procedure
> lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK_MSG procedure
> lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_MSG procedure
> lockd: Use xdrgen XDR functions for the NLMv3 TEST_RES procedure
> lockd: Use xdrgen XDR functions for the NLMv3 LOCK_RES procedure
> lockd: Use xdrgen XDR functions for the NLMv3 CANCEL_RES procedure
> lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK_RES procedure
> lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_RES procedure
> lockd: Use xdrgen XDR functions for the NLMv3 SM_NOTIFY procedure
> lockd: Convert NLMv3 server-side undefined procedures to xdrgen
> lockd: Use xdrgen XDR functions for the NLMv3 SHARE procedure
> lockd: Use xdrgen XDR functions for the NLMv3 UNSHARE procedure
> lockd: Use xdrgen XDR functions for the NLMv3 NM_LOCK procedure
> lockd: Use xdrgen XDR functions for the NLMv3 FREE_ALL procedure
> lockd: Remove C macros that are no longer used
> lockd: Remove dead code from fs/lockd/xdr.c
> lockd: Unify cast_status
>
> Documentation/sunrpc/xdr/nlm3.x | 168 ++++
> fs/lockd/Makefile | 19 +-
> fs/lockd/clnt4xdr.c | 42 +-
> fs/lockd/clntlock.c | 2 +-
> fs/lockd/clntproc.c | 14 +-
> fs/lockd/clntxdr.c | 44 +-
> fs/lockd/host.c | 4 +-
> fs/lockd/lockd.h | 57 +-
> fs/lockd/mon.c | 2 +-
> fs/lockd/nlm3xdr_gen.c | 714 ++++++++++++++
> fs/lockd/nlm3xdr_gen.h | 32 +
> fs/lockd/share.h | 4 +-
> fs/lockd/svc4proc.c | 69 +-
> fs/lockd/svclock.c | 38 +-
> fs/lockd/svcproc.c | 1844 ++++++++++++++++++++++++------------
> fs/lockd/svcshare.c | 8 +-
> fs/lockd/svcsubs.c | 2 +-
> fs/lockd/svcxdr.h | 142 ---
> fs/lockd/trace.h | 16 +-
> fs/lockd/xdr.c | 354 -------
> fs/lockd/xdr.h | 39 +-
> include/linux/sunrpc/xdrgen/nlm3.h | 210 ++++
> 22 files changed, 2538 insertions(+), 1286 deletions(-)
> ---
> base-commit: b26490baad0b7318d763b5ad6e5ca2addb20b314
> change-id: 20260427-nlm4-xdrgen-35bf1c6869b8
>
> Best regards,
> --
> Chuck Lever <chuck.lever@oracle.com>
I got a sketchy review from Gemini that I had Claude validate that
looks valid. You may want to add the memset() it recommends:
--------------8<---------------
Analysis complete. The previous review (against b201ce7af2a2
FREE_ALL) identified the right underlying bug but attributed it to the
wrong commit. Here's the corrected analysis:
Correct commit: 3de744ee4e45 — "lockd: Use xdrgen XDR functions for
the NLMv4 TEST procedure"
The regression: nlm4svc_lookup_file() (introduced in this commit)
copies only fh.len bytes of the file handle without zeroing the
remainder. Combined with .pc_argzero = 0 removing the
defensive memset of the argument buffer, bytes beyond fh.len in lock-
>fh.data contain stale data from previous RPC calls. file_hash() in
fs/lockd/svcsubs.c reads a fixed 32 bytes (NFS2_FHSIZE)
regardless of actual handle length, so for handles shorter than 32
bytes the hash is non-deterministic — the same file handle can hash to
different buckets on different calls, causing lock
state lookup failures.
Old code had two protections:
1. pc_argzero = sizeof(struct nlm_args) → zeroed the entire argp
before decode
2. svcxdr_decode_fhandle() → memset(fh->data + len, 0, sizeof(fh-
>data) - len)
Both are gone in the new code.
Fix: Add memset(lock->fh.data + xdr_lock->fh.len, 0, sizeof(lock-
>fh.data) - xdr_lock->fh.len) after the memcpy in
nlm4svc_lookup_file().
FINAL REGRESSIONS FOUND: 1
FINAL UNADDRESSED COMMENTS: 0 (no lore threads found)
BUG FIX DETERMINATION: not a bug fix
Fixes tag check for NFSD: NO (not a bug fix)
Assisted-by: Claude Code:claude-opus-4-6
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen
2026-05-14 16:52 ` [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Jeff Layton
@ 2026-05-14 17:53 ` Chuck Lever
2026-05-14 17:57 ` Jeff Layton
0 siblings, 1 reply; 42+ messages in thread
From: Chuck Lever @ 2026-05-14 17:53 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
On Thu, May 14, 2026, at 12:52 PM, Jeff Layton wrote:
> I got a sketchy review from Gemini that I had Claude validate that
> looks valid. You may want to add the memset() it recommends:
>
> --------------8<---------------
>
> Analysis complete. The previous review (against b201ce7af2a2
> FREE_ALL) identified the right underlying bug but attributed it to the
> wrong commit. Here's the corrected analysis:
>
> Correct commit: 3de744ee4e45 — "lockd: Use xdrgen XDR functions for
> the NLMv4 TEST procedure"
>
> The regression: nlm4svc_lookup_file() (introduced in this commit)
> copies only fh.len bytes of the file handle without zeroing the
> remainder. Combined with .pc_argzero = 0 removing the
> defensive memset of the argument buffer, bytes beyond fh.len in lock-
>>fh.data contain stale data from previous RPC calls. file_hash() in
> fs/lockd/svcsubs.c reads a fixed 32 bytes (NFS2_FHSIZE)
> regardless of actual handle length, so for handles shorter than 32
> bytes the hash is non-deterministic — the same file handle can hash to
> different buckets on different calls, causing lock
> state lookup failures.
This appears to be a regression introduced by the (previous) NLMv4
series, and does not affect the current NLMv3 xdrgen conversion.
I can post a fix for this later today. Note that memset() was
removed as part of the xdrgen conversion because it zeroes much
more memory than actually needs to be initialized.
--
Chuck Lever
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen
2026-05-14 17:53 ` Chuck Lever
@ 2026-05-14 17:57 ` Jeff Layton
0 siblings, 0 replies; 42+ messages in thread
From: Jeff Layton @ 2026-05-14 17:57 UTC (permalink / raw)
To: Chuck Lever, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Trond Myklebust, Anna Schumaker
Cc: linux-nfs, Chuck Lever
On Thu, 2026-05-14 at 13:53 -0400, Chuck Lever wrote:
> On Thu, May 14, 2026, at 12:52 PM, Jeff Layton wrote:
>
> > I got a sketchy review from Gemini that I had Claude validate that
> > looks valid. You may want to add the memset() it recommends:
> >
> > --------------8<---------------
> >
> > Analysis complete. The previous review (against b201ce7af2a2
> > FREE_ALL) identified the right underlying bug but attributed it to the
> > wrong commit. Here's the corrected analysis:
> >
> > Correct commit: 3de744ee4e45 — "lockd: Use xdrgen XDR functions for
> > the NLMv4 TEST procedure"
> >
> > The regression: nlm4svc_lookup_file() (introduced in this commit)
> > copies only fh.len bytes of the file handle without zeroing the
> > remainder. Combined with .pc_argzero = 0 removing the
> > defensive memset of the argument buffer, bytes beyond fh.len in lock-
> > > fh.data contain stale data from previous RPC calls. file_hash() in
> > fs/lockd/svcsubs.c reads a fixed 32 bytes (NFS2_FHSIZE)
> > regardless of actual handle length, so for handles shorter than 32
> > bytes the hash is non-deterministic — the same file handle can hash to
> > different buckets on different calls, causing lock
> > state lookup failures.
>
> This appears to be a regression introduced by the (previous) NLMv4
> series, and does not affect the current NLMv3 xdrgen conversion.
>
> I can post a fix for this later today. Note that memset() was
> removed as part of the xdrgen conversion because it zeroes much
> more memory than actually needs to be initialized.
>
I couldn't quite tell. It almost sounded like the change in the
original patch was safe, but this series removed some protections that
made it safe to skip the zeroing? In any case it sounds like a real bug
that we should probably fix, though it can be done in a later patch.
The series itself seems mostly mechanical. You can add:
Reviewed-by: Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 42+ messages in thread
end of thread, other threads:[~2026-05-14 17:57 UTC | newest]
Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 18:13 [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Chuck Lever
2026-05-12 18:13 ` [PATCH 01/38] lockd: Stop warning on nlm__int__drop_reply in !V4 cast_status Chuck Lever
2026-05-12 18:13 ` [PATCH 02/38] lockd: Correct kernel-doc status descriptions for NLMv4 GRANTED Chuck Lever
2026-05-12 18:13 ` [PATCH 03/38] lockd: Drop locks_init_lock() from nlm4_lock_to_lockd_lock() Chuck Lever
2026-05-12 18:13 ` [PATCH 04/38] lockd: Translate nlm__int__deadlock in __nlm4svc_proc_lock_msg() Chuck Lever
2026-05-12 18:13 ` [PATCH 05/38] lockd: Do not monitor when looking up the LOCK_MSG callback host Chuck Lever
2026-05-12 18:13 ` [PATCH 06/38] Documentation: Add the RPC language description of NLM version 3 Chuck Lever
2026-05-12 18:13 ` [PATCH 07/38] lockd: Rename struct nlm_cookie to lockd_cookie Chuck Lever
2026-05-12 18:13 ` [PATCH 08/38] lockd: Rename struct nlm_lock to lockd_lock Chuck Lever
2026-05-12 18:13 ` [PATCH 09/38] lockd: Rename struct nlm_args to lockd_args Chuck Lever
2026-05-12 18:13 ` [PATCH 10/38] lockd: Rename struct nlm_res to lockd_res Chuck Lever
2026-05-12 18:13 ` [PATCH 11/38] lockd: Rename struct nlm_reboot to lockd_reboot Chuck Lever
2026-05-12 18:13 ` [PATCH 12/38] lockd: Rename struct nlm_share to lockd_share Chuck Lever
2026-05-12 18:13 ` [PATCH 13/38] lockd: Use xdrgen XDR functions for the NLMv3 NULL procedure Chuck Lever
2026-05-12 18:13 ` [PATCH 14/38] lockd: Use xdrgen XDR functions for the NLMv3 TEST procedure Chuck Lever
2026-05-12 18:13 ` [PATCH 15/38] lockd: Use xdrgen XDR functions for the NLMv3 LOCK procedure Chuck Lever
2026-05-12 18:13 ` [PATCH 16/38] lockd: Use xdrgen XDR functions for the NLMv3 CANCEL procedure Chuck Lever
2026-05-12 18:13 ` [PATCH 17/38] lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK procedure Chuck Lever
2026-05-12 18:13 ` [PATCH 18/38] lockd: Use xdrgen XDR functions for the NLMv3 GRANTED procedure Chuck Lever
2026-05-12 18:13 ` [PATCH 19/38] lockd: Refactor nlmsvc_callback() Chuck Lever
2026-05-12 18:13 ` [PATCH 20/38] lockd: Use xdrgen XDR functions for the NLMv3 TEST_MSG procedure Chuck Lever
2026-05-12 18:13 ` [PATCH 21/38] lockd: Use xdrgen XDR functions for the NLMv3 LOCK_MSG procedure Chuck Lever
2026-05-12 18:13 ` [PATCH 22/38] lockd: Use xdrgen XDR functions for the NLMv3 CANCEL_MSG procedure Chuck Lever
2026-05-12 18:13 ` [PATCH 23/38] lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK_MSG procedure Chuck Lever
2026-05-12 18:13 ` [PATCH 24/38] lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_MSG procedure Chuck Lever
2026-05-12 18:14 ` [PATCH 25/38] lockd: Use xdrgen XDR functions for the NLMv3 TEST_RES procedure Chuck Lever
2026-05-12 18:14 ` [PATCH 26/38] lockd: Use xdrgen XDR functions for the NLMv3 LOCK_RES procedure Chuck Lever
2026-05-12 18:14 ` [PATCH 27/38] lockd: Use xdrgen XDR functions for the NLMv3 CANCEL_RES procedure Chuck Lever
2026-05-12 18:14 ` [PATCH 28/38] lockd: Use xdrgen XDR functions for the NLMv3 UNLOCK_RES procedure Chuck Lever
2026-05-12 18:14 ` [PATCH 29/38] lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_RES procedure Chuck Lever
2026-05-12 18:14 ` [PATCH 30/38] lockd: Use xdrgen XDR functions for the NLMv3 SM_NOTIFY procedure Chuck Lever
2026-05-12 18:14 ` [PATCH 31/38] lockd: Convert NLMv3 server-side undefined procedures to xdrgen Chuck Lever
2026-05-12 18:14 ` [PATCH 32/38] lockd: Use xdrgen XDR functions for the NLMv3 SHARE procedure Chuck Lever
2026-05-12 18:14 ` [PATCH 33/38] lockd: Use xdrgen XDR functions for the NLMv3 UNSHARE procedure Chuck Lever
2026-05-12 18:14 ` [PATCH 34/38] lockd: Use xdrgen XDR functions for the NLMv3 NM_LOCK procedure Chuck Lever
2026-05-12 18:14 ` [PATCH 35/38] lockd: Use xdrgen XDR functions for the NLMv3 FREE_ALL procedure Chuck Lever
2026-05-12 18:14 ` [PATCH 36/38] lockd: Remove C macros that are no longer used Chuck Lever
2026-05-12 18:14 ` [PATCH 37/38] lockd: Remove dead code from fs/lockd/xdr.c Chuck Lever
2026-05-12 18:14 ` [PATCH 38/38] lockd: Unify cast_status Chuck Lever
2026-05-14 16:52 ` [PATCH 00/38] lockd: Convert NLMv3 server-side procedures to xdrgen Jeff Layton
2026-05-14 17:53 ` Chuck Lever
2026-05-14 17:57 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox