lockd: fix GRANTED_MSG handling
Subsystems (2)
Olga Kornievskaia
reviewerPATCH 1/1 lockd: fix GRANTED_MSG handling
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.
--- fs/lockd/svc4proc.c | 3 ++- fs/lockd/svcproc.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
fs/lockd/svc4proc.c +2 -1
@@ -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;
fs/lockd/svcproc.c +2 -1
@@ -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;
Signature · 1 line
2.52.0
Quoted 36 lines · Olga Kornievskaia
GRANTED_MSGis a server-to-client callback, so it runs on the client, where nfsd never registersnlmsvc_ops. The nlm4svc_lookup_host()/nlm3svc_lookup_host()helpers are for the server-side request handlers (TEST/LOCK/CANCEL/UNLOCK), which reachnlmsvc_ops->fopenand must reject requests when nfsd isn't running.GRANTED_MSGonly callsnlmclnt_grant(). Instead, of calling nlm4svc_lookup_host()/nlm3svc_lookup_host()(which results in a client failing aGRANTED_MSGcall) callnlmsvc_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(-)fs/lockd/svc4proc.c +2
-1@@ -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;fs/lockd/svcproc.c +0
-0
fs/lockd/svcproc.c static __be32 nlmsvc_proc_granted_msg(struct svc_rqst *rqstp) · line 908
Quoted 9 lines
fs/lockd/svcproc.c +2
-1@@ -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;
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
Chuck Lever
maintainerQuoted 9 lines · Olga Kornievskaia
GRANTED_MSGis a server-to-client callback, so it runs on the client, where nfsd never registersnlmsvc_ops. The nlm4svc_lookup_host()/nlm3svc_lookup_host()helpers are for the server-side request handlers (TEST/LOCK/CANCEL/UNLOCK), which reachnlmsvc_ops->fopenand must reject requests when nfsd isn't running.GRANTED_MSGonly callsnlmclnt_grant(). Instead, of calling nlm4svc_lookup_host()/nlm3svc_lookup_host()(which results in a client failing aGRANTED_MSGcall) callnlmsvc_lookup_host.
Quoted 5 lines
Fixes 62721885e861 ("lockd: Use xdrgen XDR functions for the NLMv4
GRANTED_MSGprocedure")Fixes 6c534ad999b6 ("lockd: Use xdrgen XDR functions for the NLMv3
GRANTED_MSGprocedure")Signed-off-by Olga Kornievskaia <[email protected]>
The fix LGTM.
Looking at this now, I see the patch targets two distinct stable kernels. Therefore IMO this does actually need to be two separate patches. I will split the patch when I apply it to nfsd-testing.
Signature · 1 line
Chuck Lever