Re: [PATCH 1/1] lockd: fix GRANTED_MSG handling

NeilBrown <[email protected]>
Newsgroups gmane.linux.nfs
Message-ID <[email protected]>
On Fri, 26 Jun 2026, Olga Kornievskaia wrote:
> GRANTED_MSG is a server-to-client callback, so it runs on the client,
> where nfsd never registers nlmsvc_ops. The nlm4svc_lookup_host()/
> nlm3svc_lookup_host() helpers are for the server-side request handlers
> (TEST/LOCK/CANCEL/UNLOCK), which reach nlmsvc_ops->fopen and must
> reject requests when nfsd isn't running. GRANTED_MSG only calls
> nlmclnt_grant(). Instead, of calling nlm4svc_lookup_host()/
> nlm3svc_lookup_host() (which results in a client failing a GRANTED_MSG
> call) call nlmsvc_lookup_host.
> 
> Fixes: 62721885e861 ("lockd: Use xdrgen XDR functions for the NLMv4 GRANTED_MSG procedure")
> Fixes: 6c534ad999b6 ("lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_MSG procedure")
> Signed-off-by: Olga Kornievskaia <[email protected]>
> ---
>  fs/lockd/svc4proc.c | 3 ++-
>  fs/lockd/svcproc.c  | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
> index 080dffce9d8e..b73004a7987e 100644
> --- a/fs/lockd/svc4proc.c
> +++ b/fs/lockd/svc4proc.c
> @@ -872,7 +872,8 @@ static __be32 nlm4svc_proc_granted_msg(struct svc_rqst *rqstp)
>  	struct nlm4_testargs_wrapper *argp = rqstp->rq_argp;
>  	struct nlm_host *host;
>  
> -	host = nlm4svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
> +	host = nlmsvc_lookup_host(rqstp, argp->xdrgen.alock.caller_name.data,
> +				  argp->xdrgen.alock.caller_name.len);
>  	if (!host)
>  		return rpc_system_err;
>  
> diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
> index dce6f6e3fd40..d410b8c69893 100644
> --- a/fs/lockd/svcproc.c
> +++ b/fs/lockd/svcproc.c
> @@ -901,7 +901,8 @@ static __be32 nlmsvc_proc_granted_msg(struct svc_rqst *rqstp)
>  	if (argp->xdrgen.cookie.len > NLM_MAXCOOKIELEN)
>  		return rpc_garbage_args;
>  
> -	host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
> +	host = nlmsvc_lookup_host(rqstp, argp->xdrgen.alock.caller_name.data,
> +				  argp->xdrgen.alock.caller_name.len);
>  	if (!host)
>  		return rpc_system_err;
>  

Reviewed-by: NeilBrown <neil-+NVA1uvv1dVBDLzU/[email protected]>

That is a subtle difference between nlm4svc_lookup_host() and
nlmsvc_lookup_host().  I wonder if making the names more distinct would
help...

Thanks,
NeilBrown
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.