lockd: Convert server-side undefined procedures to xdrgen

The NLMv4 protocol defines several procedure slots that are
not implemented. These undefined procedures need proper
handling to return rpc_proc_unavail to clients that
mistakenly invoke them.

This patch converts the three undefined procedure entries
(slots 17, 18, and 19) to use xdrgen functions
nlm4_svc_decode_void and nlm4_svc_encode_void. The
nlm4svc_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
correctly set to zero since no arguments or results are
processed. The pc_xdrressize field is updated to XDR_void
to accurately reflect the response size.

This conversion completes the migration of all NLMv4
server-side procedures to use xdrgen-generated XDR
functions, improving type safety and eliminating
hand-written XDR code.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
Chuck Lever 2026-02-17 17:07:12 -05:00
parent 16099e1002
commit 5eae0e00dc

View File

@ -1029,6 +1029,18 @@ static __be32 nlm4svc_proc_sm_notify(struct svc_rqst *rqstp)
return rpc_success;
}
/**
* nlm4svc_proc_unused - stub for unused procedures
* @rqstp: RPC transaction context
*
* Returns:
* %rpc_proc_unavail: Program can't support procedure.
*/
static __be32 nlm4svc_proc_unused(struct svc_rqst *rqstp)
{
return rpc_proc_unavail;
}
/*
* SHARE: create a DOS share or alter existing share.
*/
@ -1133,12 +1145,6 @@ nlm4svc_proc_free_all(struct svc_rqst *rqstp)
return rpc_success;
}
static __be32
nlm4svc_proc_unused(struct svc_rqst *rqstp)
{
return rpc_proc_unavail;
}
/*
* NLM Server procedures.
@ -1323,34 +1329,34 @@ static const struct svc_procedure nlm4svc_procedures[24] = {
.pc_name = "SM_NOTIFY",
},
[17] = {
.pc_func = nlm4svc_proc_unused,
.pc_decode = nlm4svc_decode_void,
.pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_void),
.pc_argzero = sizeof(struct nlm_void),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = 0,
.pc_name = "UNUSED",
.pc_func = nlm4svc_proc_unused,
.pc_decode = nlm4_svc_decode_void,
.pc_encode = nlm4_svc_encode_void,
.pc_argsize = 0,
.pc_argzero = 0,
.pc_ressize = 0,
.pc_xdrressize = XDR_void,
.pc_name = "UNUSED",
},
[18] = {
.pc_func = nlm4svc_proc_unused,
.pc_decode = nlm4svc_decode_void,
.pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_void),
.pc_argzero = sizeof(struct nlm_void),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = 0,
.pc_name = "UNUSED",
.pc_func = nlm4svc_proc_unused,
.pc_decode = nlm4_svc_decode_void,
.pc_encode = nlm4_svc_encode_void,
.pc_argsize = 0,
.pc_argzero = 0,
.pc_ressize = 0,
.pc_xdrressize = XDR_void,
.pc_name = "UNUSED",
},
[19] = {
.pc_func = nlm4svc_proc_unused,
.pc_decode = nlm4svc_decode_void,
.pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_void),
.pc_argzero = sizeof(struct nlm_void),
.pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = 0,
.pc_name = "UNUSED",
.pc_func = nlm4svc_proc_unused,
.pc_decode = nlm4_svc_decode_void,
.pc_encode = nlm4_svc_encode_void,
.pc_argsize = 0,
.pc_argzero = 0,
.pc_ressize = 0,
.pc_xdrressize = XDR_void,
.pc_name = "UNUSED",
},
[NLMPROC_SHARE] = {
.pc_func = nlm4svc_proc_share,