Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7831241rwl; Tue, 10 Jan 2023 06:02:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXtf9B0hq9R8TvemP+pxPMg2I4N8xwZCypIKiDDNqcIlfL+HYYiik6Tg47yLDSg+8mFdlSGd X-Received: by 2002:a05:651c:170b:b0:287:1e1a:f2de with SMTP id be11-20020a05651c170b00b002871e1af2demr586485ljb.23.1673359377249; Tue, 10 Jan 2023 06:02:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673359377; cv=none; d=google.com; s=arc-20160816; b=Bt+CsCVxab+MHfwp6q3cYD1tiGTeu1jwZL14OWSpwOlX1H0LOOCS9IVZsZEj3Vob9K jmNI7mitdYwuX4pP3zqJZSMGPIzyx7TXmuLZ/z4vhwGvT7XbbNOXRyHk+w5FAddHo0wB m6xxJCpnB0UP4L5mYpM1/KsmDWKXCB0bVyuIN7gMN99iwHI9cDcU0W/ey7kYhC7j0n0+ O6Zsl2hyV4KJZmFNgBKSD0FXt07iq7xCZiGqoZ953QdNYUOoJnayJ9kFQf9IIh0nYtQ/ qYo194P4pGUxFvvfJESEQEJLdq2mIBjfVVk7LGxVd02+R2yp/SErXQKCaJgcuvERFIQ8 59RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:to:from :subject:message-id:dkim-signature; bh=MHlf4F12Hyjg9EplqFBiteaq3aAXBdv9tCl4jCuWW44=; b=BpFHMlo8cY1xTJCJL85V4FBVrqu5tvXdOG3EyHelj/fgNnF8I3R5TFocJ4ddwLQdAr b3TbfovqD5/pgdI6X+PLHNUQjO69R0CnzS/jOZEgQtxXpyOjg0oM5ZQMSHumAjo05+iG UHDOun0TtR+/2VRqQSL3rGGPwmZlPrVcEkB1Wy29bABWB31LyipSpkPqjIRBA/jvVfKK kNW3ZgmPutJSyBtB4IeXvnNtKdZwRzqj5Gpe6dCQd5OVu7Nj6qLZW9f2HE4X0MUFKQKB dJJU3z1qmg+8ArmybRxAuvzI3AO06pUHH/l2RENqNtwxONd8hfhWIb/H3hiSg6DPCjPd GHYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MgpDoMYj; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr6-20020a170907720600b0084d197a89e2si11473688ejc.957.2023.01.10.06.02.16; Tue, 10 Jan 2023 06:02:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MgpDoMYj; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231532AbjAJOBy (ORCPT + 99 others); Tue, 10 Jan 2023 09:01:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232395AbjAJOBX (ORCPT ); Tue, 10 Jan 2023 09:01:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93FDD5015A for ; Tue, 10 Jan 2023 06:01:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F67161277 for ; Tue, 10 Jan 2023 14:01:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4378DC433D2; Tue, 10 Jan 2023 14:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673359281; bh=TlJSruzTz9G3o5E6eqJdxRfSFEFgjfhyCdsLqNytZZ8=; h=Subject:From:To:Date:In-Reply-To:References:From; b=MgpDoMYj3wY70b521rwsTxAlOYp5OtC2/2pBL96ejYUrKCdAFOMVpIDvFM0d/fYKD SMf3/2Ljhx8hsAC/IDC95RadFMRMhCyLOBfg7w9l/EH92Ux4Rp/7MEGAelTnhYhNRr UMoqUPEJJhEqQRJaRrH6Cw6L5ENLyPEp6wotSColm/EV6JHb1jFH87o/crkt+yFUNQ qSObdzPdM3apwK31Se37bgzffllHqlA1qqI/SVX+0E4mdy/GjrRSNqgdXUsWhuVHgE llTn3Cntrp+MGwOvccxzioyynrBhReNt4xxs7DX6Hkob8FtRihCh3uhstknr37+1ol OmYg2MG9BikBg== Message-ID: Subject: Re: [PATCH v1 01/27] SUNRPC: Clean up svcauth_gss_release() From: Jeff Layton To: Chuck Lever , linux-nfs@vger.kernel.org Date: Tue, 10 Jan 2023 09:01:19 -0500 In-Reply-To: <167319531054.7490.10405247832294580026.stgit@bazille.1015granger.net> References: <167319499150.7490.2294168831574653380.stgit@bazille.1015granger.net> <167319531054.7490.10405247832294580026.stgit@bazille.1015granger.net> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.2 (3.46.2-1.fc37) MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Sun, 2023-01-08 at 11:28 -0500, Chuck Lever wrote: > From: Chuck Lever >=20 > Now that upper layers use an xdr_stream to track the construction > of each RPC Reply message, resbuf->len is kept up-to-date > automatically. There's no need to recompute it in svc_gss_release(). >=20 > Signed-off-by: Chuck Lever > --- > net/sunrpc/auth_gss/svcauth_gss.c | 30 ++++++++++++++++-------------- > 1 file changed, 16 insertions(+), 14 deletions(-) >=20 > diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svca= uth_gss.c > index 2e603358fae1..4a576ed7aa32 100644 > --- a/net/sunrpc/auth_gss/svcauth_gss.c > +++ b/net/sunrpc/auth_gss/svcauth_gss.c > @@ -969,12 +969,6 @@ svcauth_gss_unwrap_integ(struct svc_rqst *rqstp, u32= seq, struct gss_ctx *ctx) > return -EINVAL; > } > =20 > -static inline int > -total_buf_len(struct xdr_buf *buf) > -{ > - return buf->head[0].iov_len + buf->page_len + buf->tail[0].iov_len; > -} > - > /* > * RFC 2203, Section 5.3.2.3 > * > @@ -1882,14 +1876,25 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp= ) > return 0; > } > =20 > +/** > + * svcauth_gss_release - Wrap payload and release resources > + * @rqstp: RPC transaction context > + * > + * Return values: > + * %0: the Reply is ready to be sent > + * %-ENOMEM: failed to allocate memory > + * %-EINVAL: encoding error > + * > + * XXX: These return values do not match the return values documented > + * for the auth_ops ->release method in linux/sunrpc/svcauth.h. As an aside... It looks like the only place ->release is called is in svc_authorise, and its callers either ignore the return, or just test whether it succeeded (returned 0). If it fails then it looks like the xprt is closed. The actual return code doesn't matter at all. We could make ->release a bool return to make that clear. That's not directly related to this set though. > static int > svcauth_gss_release(struct svc_rqst *rqstp) > { > - struct gss_svc_data *gsd =3D (struct gss_svc_data *)rqstp->rq_auth_data= ; > - struct rpc_gss_wire_cred *gc; > - struct xdr_buf *resbuf =3D &rqstp->rq_res; > - int stat =3D -EINVAL; > struct sunrpc_net *sn =3D net_generic(SVC_NET(rqstp), sunrpc_net_id); > + struct gss_svc_data *gsd =3D rqstp->rq_auth_data; > + struct rpc_gss_wire_cred *gc; > + int stat; > =20 > if (!gsd) > goto out; > @@ -1899,10 +1904,7 @@ svcauth_gss_release(struct svc_rqst *rqstp) > /* Release can be called twice, but we only wrap once. */ > if (gsd->verf_start =3D=3D NULL) > goto out; > - /* normally not set till svc_send, but we need it here: */ > - /* XXX: what for? Do we mess it up the moment we call svc_putu32 > - * or whatever? */ > - resbuf->len =3D total_buf_len(resbuf); > + > switch (gc->gc_svc) { > case RPC_GSS_SVC_NONE: > break; >=20 >=20 The patch itself looks fine. Reviewed-by: Jeff Layton