mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
lockd: Use xdrgen XDR functions for the NLMv3 GRANTED_MSG procedure
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. Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
6a2f89e49b
commit
6c534ad999
|
|
@ -594,23 +594,6 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp)
|
||||||
rpc_drop_reply : rpc_success;
|
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
|
* nlmsvc_proc_granted - GRANTED: Blocked lock has been granted
|
||||||
* @rqstp: RPC transaction context
|
* @rqstp: RPC transaction context
|
||||||
|
|
@ -966,19 +949,52 @@ static __be32 nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp)
|
||||||
__nlmsvc_proc_unlock_msg);
|
__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)
|
static __be32 nlmsvc_proc_granted_msg(struct svc_rqst *rqstp)
|
||||||
{
|
{
|
||||||
struct lockd_args *argp = rqstp->rq_argp;
|
struct nlm_testargs_wrapper *argp = rqstp->rq_argp;
|
||||||
struct nlm_host *host;
|
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)
|
if (!host)
|
||||||
return rpc_system_err;
|
return rpc_system_err;
|
||||||
|
|
||||||
return nlmsvc_callback(rqstp, host, NLMPROC_GRANTED_RES,
|
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_xdrressize = XDR_void,
|
||||||
.pc_name = "UNLOCK_MSG",
|
.pc_name = "UNLOCK_MSG",
|
||||||
},
|
},
|
||||||
[NLMPROC_GRANTED_MSG] = {
|
[NLM_GRANTED_MSG] = {
|
||||||
.pc_func = nlmsvc_proc_granted_msg,
|
.pc_func = nlmsvc_proc_granted_msg,
|
||||||
.pc_decode = nlmsvc_decode_testargs,
|
.pc_decode = nlm_svc_decode_nlm_testargs,
|
||||||
.pc_encode = nlmsvc_encode_void,
|
.pc_encode = nlm_svc_encode_void,
|
||||||
.pc_argsize = sizeof(struct lockd_args),
|
.pc_argsize = sizeof(struct nlm_testargs_wrapper),
|
||||||
.pc_argzero = sizeof(struct lockd_args),
|
.pc_argzero = 0,
|
||||||
.pc_ressize = sizeof(struct nlm_void),
|
.pc_ressize = 0,
|
||||||
.pc_xdrressize = St,
|
.pc_xdrressize = XDR_void,
|
||||||
.pc_name = "GRANTED_MSG",
|
.pc_name = "GRANTED_MSG",
|
||||||
},
|
},
|
||||||
[NLMPROC_TEST_RES] = {
|
[NLMPROC_TEST_RES] = {
|
||||||
.pc_func = nlmsvc_proc_null,
|
.pc_func = nlmsvc_proc_null,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user