Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2834227pxb; Tue, 24 Aug 2021 08:38:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyno3NIgDnEFSvMEgMCkK7P0gGyro3RDd/HBg9Y9nR43FZKG7FjOdB1t1JeFyfQk7WjJB19 X-Received: by 2002:a17:906:fcda:: with SMTP id qx26mr19924098ejb.121.1629819537705; Tue, 24 Aug 2021 08:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629819537; cv=none; d=google.com; s=arc-20160816; b=MEPTqEGt+umz4/PNwgg30ybsX4TY3gvYMuIIcXrm0Ij6ZyFxrcXPNKm/4mxnK3aUKv nC8QKj8tgQ+GJsMYlaaeorH+P5BmvmUA07vc1VrNuBMelw/4hyH1q3pye1oimROfPtCa gaXHaGLKy54N7rzXtHJZ8VfTcyfLXvdNzXSO3POoiQQY7NohpJIzHO6xGGpBVti8T2lP ELmCxv9J9hi+rTfBoqwPsMhjuVN0SC5kVoXgrwFTe6GokAismjey0cjni8+pNCgn2uje M4te8yaoArGzzDQmKHGpbHQJ2Rb717/0vSBUWuhM4/B6Aaa14hzVd0SSse8LwMPvs5dG zI5A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=XHZjnKtJ6xrTYTjPzSRGAKEvzvosb5HMTIgcSSBcGL4=; b=J1B88p7eCP5S4HibKI3rCDiYKH4sUac0XxDxPoQq/ulAQaubLrBVU/MhBH1ax6Oq5G 7iXa7N1xuB9BpYeCTdr9xMr7m5HRW7gb6ieceJonRq1TWS5/3oIbnX3x201yxGllRsid 8AxRqVkIhpYged1rewAQ3nJF0qWPkvpVDPm2EBBBbl2djnXoABigL89tEf54YSAyJOhN bNM9uGQKDchPOFOKuJOItUlRcbpVhpoW7TlbdCXUEY1ceS8jJkXDHPJGRiMM2SZSjJ4o hThqdDWPgbFzBaqRgQskjS57a9biN1xs4X/h1BvpJaYz1GpJT9VqDRFDOY6znoV458DV T8+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GIHMb5fe; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p26si19512682edu.78.2021.08.24.08.38.24; Tue, 24 Aug 2021 08:38:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GIHMb5fe; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 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 S238284AbhHXPjE (ORCPT + 99 others); Tue, 24 Aug 2021 11:39:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:43774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234546AbhHXPjE (ORCPT ); Tue, 24 Aug 2021 11:39:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7830D61151; Tue, 24 Aug 2021 15:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629819499; bh=kz5dpKm3mk2Yt7edtfvSS17rQvTHBQ4kcZeU64c03Qg=; h=From:To:Cc:Subject:Date:From; b=GIHMb5feSOnGC+Au3p2g9x+vNrXRx8Njs9yj8OhIjkfr/ElENjEMaedMeN4Gb/fuH tkxiXf7/pwRgw7sgMBvs3A4Zu+cQO5mlRNmYZe42Ltd/1ICmTpO75iz4qgct+/+hRA TT2AFmqadzhjo5xRFu08CRl6LCr73LYcVJC7YuMEmxSbT7g1YhX/gzJ97RFVb2s+oQ Hu6z07eWrvsvLJzFWFwzpTFCkqPLI/ph8vBfFam3cDifhGozkLIXuCWtrjpvosn1Uk 9cYi8y3g0w7GOeLIsvfYmQk0iqNEwfJsGTXNIt/Lp01MMRS+o1TfSoLk8tkGfMf1QJ luiqD1brEZDVw== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 1/2] SUNRPC: Simplify socket shutdown when not reusing TCP ports Date: Tue, 24 Aug 2021 11:38:17 -0400 Message-Id: <20210824153818.322833-1-trondmy@kernel.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust If we're not required to reuse the TCP port, then we can just immediately close the socket, and leave the cleanup details to the TCP layer. Fixes: e6237b6feb37 ("NFSv4.1: Don't rebind to the same source port when reconnecting to the server") Signed-off-by: Trond Myklebust --- net/sunrpc/xprtsock.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index e573dcecdd66..7e94f1d17edb 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -2099,6 +2099,10 @@ static void xs_tcp_shutdown(struct rpc_xprt *xprt) if (sock == NULL) return; + if (!xprt->reuseport) { + xs_close(xprt); + return; + } switch (skst) { default: kernel_sock_shutdown(sock, SHUT_RDWR); -- 2.31.1