diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2023-01-08 17:29:51 +0100 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2023-02-20 15:20:28 +0100 |
commit | faca8978163bf8f6c0f3043b0f03cf3fe7bf9d64 (patch) | |
tree | 988a251873c1428edae40e2142fcb56409f7adb5 /net | |
parent | SUNRPC: Push svcxdr_init_encode() into svc_process_common() (diff) | |
download | linux-faca8978163bf8f6c0f3043b0f03cf3fe7bf9d64.tar.xz linux-faca8978163bf8f6c0f3043b0f03cf3fe7bf9d64.zip |
SUNRPC: Move svcxdr_init_encode() into ->accept methods
Refactor: So that the overhaul of each ->accept method can be done
in separate smaller patches, temporarily move the
svcxdr_init_encode() call into those methods.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth_gss/svcauth_gss.c | 5 | ||||
-rw-r--r-- | net/sunrpc/svc.c | 6 | ||||
-rw-r--r-- | net/sunrpc/svcauth_unix.c | 3 |
3 files changed, 10 insertions, 4 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 6ef4f1ecbeec..5c41c34dd83e 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -1250,6 +1250,7 @@ svcauth_gss_legacy_init(struct svc_rqst *rqstp, goto out; ret = SVC_COMPLETE; + svcxdr_init_encode(rqstp); out: cache_put(&rsip->h, sn->rsi_cache); return ret; @@ -1378,6 +1379,7 @@ static int svcauth_gss_proxy_init(struct svc_rqst *rqstp, goto out; ret = SVC_COMPLETE; + svcxdr_init_encode(rqstp); out: gss_free_in_token_pages(&ud.in_token); gssp_free_upcall_data(&ud); @@ -1680,6 +1682,7 @@ svcauth_gss_accept(struct svc_rqst *rqstp) rqstp->rq_auth_stat = rpc_autherr_badcred; switch (gc->gc_svc) { case RPC_GSS_SVC_NONE: + svcxdr_init_encode(rqstp); break; case RPC_GSS_SVC_INTEGRITY: /* placeholders for length and seq. number: */ @@ -1689,6 +1692,7 @@ svcauth_gss_accept(struct svc_rqst *rqstp) rsci->mechctx)) goto garbage_args; rqstp->rq_auth_slack = RPC_MAX_AUTH_SIZE; + svcxdr_init_encode(rqstp); break; case RPC_GSS_SVC_PRIVACY: /* placeholders for length and seq. number: */ @@ -1698,6 +1702,7 @@ svcauth_gss_accept(struct svc_rqst *rqstp) rsci->mechctx)) goto garbage_args; rqstp->rq_auth_slack = RPC_MAX_AUTH_SIZE * 2; + svcxdr_init_encode(rqstp); break; default: goto auth_err; diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index ce75db5eb9bd..dc23fe44b5bd 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -1312,16 +1312,14 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *resv) serv->sv_stats->rpccnt++; trace_svc_process(rqstp, progp->pg_name); - /* Build the reply header. */ - statp = resv->iov_base +resv->iov_len; - svc_putnl(resv, RPC_SUCCESS); + statp = xdr_reserve_space(&rqstp->rq_res_stream, XDR_UNIT); + *statp = rpc_success; /* un-reserve some of the out-queue now that we have a * better idea of reply size */ if (procp->pc_xdrressize) svc_reserve_auth(rqstp, procp->pc_xdrressize<<2); - svcxdr_init_encode(rqstp); /* Call the function that processes the request. */ rc = process.dispatch(rqstp, statp); diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index f09a148aa0c1..6281d23f98bf 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c @@ -778,6 +778,7 @@ svcauth_null_accept(struct svc_rqst *rqstp) svc_putnl(resv, 0); rqstp->rq_cred.cr_flavor = RPC_AUTH_NULL; + svcxdr_init_encode(rqstp); return SVC_OK; } @@ -865,6 +866,7 @@ svcauth_tls_accept(struct svc_rqst *rqstp) svc_putnl(resv, 0); rqstp->rq_cred.cr_flavor = RPC_AUTH_TLS; + svcxdr_init_encode(rqstp); return SVC_OK; } @@ -960,6 +962,7 @@ svcauth_unix_accept(struct svc_rqst *rqstp) svc_putnl(resv, 0); rqstp->rq_cred.cr_flavor = RPC_AUTH_UNIX; + svcxdr_init_encode(rqstp); return SVC_OK; badcred: |