Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3259623pxb; Mon, 18 Apr 2022 20:57:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLCPS58ORA9Am7k9dTRktitmPlQ+VePsrZoh1x52/jwcSJeU2JfHVHZuBfiDg8HMuBQ/07 X-Received: by 2002:a63:e048:0:b0:39c:c3a3:cfb5 with SMTP id n8-20020a63e048000000b0039cc3a3cfb5mr12644868pgj.579.1650340665388; Mon, 18 Apr 2022 20:57:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650340665; cv=none; d=google.com; s=arc-20160816; b=gGhXPPsBZNxAn0q02JyK+i9huOKIHN+Tu4mt7jy9XkoQ6zu1X0FfkreeD356oKSN1G gpzAo7Y0kTTuRxgxBwSVxegDQ+WKt+lrbmRQDpJOzXuODm0DwGvOxXLNCbnRYBr6HePx Ow3PPw0x/7crScGqybmvotyCHmg/MHMmoj6N4lgWXSibsNZPoT9xjKPjsdN56j4mEQdH YJGZlccVKghbj39SAeSEfcvKqkPrNHM7FGL2k0qjoeb7Mo9Gm0fhf3mnoeTr7I8BFQjL 5mpdjoWL/IGQtYrwpFN/UZjBO3MEpB/W0POPjXLThn3n86Gi5tphYUiGnYHJgkhTiHw+ MCAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject; bh=g0mx76lheetjqTRZzHFmtXEJpa0zvCgvCOebiQSOT0k=; b=I3H9OZlFiTUnYWfgJs1mK67h03LX/BtKG1/+TokGlngUYX7Wclhk7Ituvykrsfos9H DQKOlsDDRLyrk6zkmWOD+naOccuYDab8nuC4QXD0s3a1PqAYRqysxIe9pzZKm5aUt5yd JusEVyGD0zNBmmetjoaqE1zNc75QCApaw6FTpSkA60FIQLRfJrgf1WZBbbapXIEEj+2q RauZVlcsbu7kUWIM/LfyNRjPSPThnFfCFgoL1Le1NjYREeCCnJvcaqGN+2ofuFMdCjcu Ea5GqTBvz7u1J2J7JVOqF6s0DikuG31S41dODOpgsrgN9EPZvfVoBshkKOiQ7N5U80vK FYnA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e4-20020a637444000000b0039905bfa26esi12465176pgn.788.2022.04.18.20.57.15; Mon, 18 Apr 2022 20:57:45 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346580AbiDRQyO (ORCPT + 99 others); Mon, 18 Apr 2022 12:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346578AbiDRQyF (ORCPT ); Mon, 18 Apr 2022 12:54:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD8FA33A01; Mon, 18 Apr 2022 09:51:22 -0700 (PDT) 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 7756A612FB; Mon, 18 Apr 2022 16:51:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59FEFC385A7; Mon, 18 Apr 2022 16:51:21 +0000 (UTC) Subject: [PATCH RFC 02/15] SUNRPC: Ignore data_ready callbacks during TLS handshakes From: Chuck Lever To: netdev@vger.kernel.org, linux-nfs@vger.kernel.org, linux-nvme@lists.infradead.org, linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: ak@tempesta-tech.com, borisp@nvidia.com, simo@redhat.com Date: Mon, 18 Apr 2022 12:51:20 -0400 Message-ID: <165030068031.5246.6914334811243049065.stgit@oracle-102.nfsv4.dev> In-Reply-To: <165030062272.5246.16956092606399079004.stgit@oracle-102.nfsv4.dev> References: <165030062272.5246.16956092606399079004.stgit@oracle-102.nfsv4.dev> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 The RPC header parser doesn't recognize TLS handshake traffic, so it will close the connection prematurely. To avoid that, shunt the transport's data_ready callback when there is a TLS handshake in progress. The ignore_dr boolean will be toggled by code added in a subsequent patch. Signed-off-by: Chuck Lever --- include/linux/sunrpc/xprtsock.h | 1 + net/sunrpc/xprtsock.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h index 38284f25eddf..426c3bd516fe 100644 --- a/include/linux/sunrpc/xprtsock.h +++ b/include/linux/sunrpc/xprtsock.h @@ -40,6 +40,7 @@ struct sock_xprt { len; unsigned long copied; + bool ignore_dr; } recv; /* diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index e62d339ba589..b5bc03c52b9b 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -703,6 +703,8 @@ static void xs_poll_check_readable(struct sock_xprt *transport) { clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state); + if (transport->recv.ignore_dr) + return; if (!xs_poll_socket_readable(transport)) return; if (!test_and_set_bit(XPRT_SOCK_DATA_READY, &transport->sock_state)) @@ -1394,6 +1396,10 @@ static void xs_data_ready(struct sock *sk) trace_xs_data_ready(xprt); transport->old_data_ready(sk); + + if (transport->recv.ignore_dr) + return; + /* Any data means we had a useful conversation, so * then we don't need to delay the next reconnect */ @@ -2779,6 +2785,7 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args, } new = container_of(xprt, struct sock_xprt, xprt); + new->recv.ignore_dr = false; mutex_init(&new->recv_mutex); memcpy(&xprt->addr, args->dstaddr, args->addrlen); xprt->addrlen = args->addrlen;