Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7149520ybi; Mon, 8 Jul 2019 15:38:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqySPZ8QrAjKxDrmYB024pSR2W3TbZeSce1F5a0OQLjLH9vGx3lgWr5OZqnOhKGpD/SYOk8v X-Received: by 2002:a17:90a:cb01:: with SMTP id z1mr28280727pjt.93.1562625501546; Mon, 08 Jul 2019 15:38:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625501; cv=none; d=google.com; s=arc-20160816; b=y4XZG8STJ2h8PrB5tE5/7aSW2wkt2qlLn1aqXvtjFHgLmePcKrVPhknCL+ZRuuGdHT izEUJyewuP53cwUdUcVxh9nw/8XXVJQjNOfLN/d3ZYdtyNKiKocYB2zCZ/T1P7/qRNQK dyAj7F0SOVWWU8KEbhzYTQzaDd4WF3H2Y/B7gZom3dXFrUmufC/8+vQUlC8m3Em+vNQo mnnVAQfy+81JCPztCCGz9BSaFVc0As3CQiR1P12gxkRacUT5CMx8v96ZaqBC7eOIxy0T J4zTmN6Tml8Z7giKz6FGLad1Ynsnl6vp7IAUL/jDo1bGGerybUTIPKmhnamNsjL1+I9o I7jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xHJShAg4e3j1wafwIRScCTqSiJjBRBCkpWbbS1CcSJM=; b=BbMNPF3P4aGDJSDw1hb+SIqer+RDRzTR9LyYcfBpeQAg3UWPkG5gCGh7O9lt+58Q1N q+juSn2ubqSWDPKWf72qwAwjm+r2Sc5uyLsSXaNErwTjA5eFI+vwDJsss2s3QBBsu63O HzTJnNzEpkyg+SuDTEHt6FwAVf12yX5nxHmiqz3bl92y/KbctICVwYBTDU/gW1+yIrCL fWP+lLxLOwIGMUIXtxVPc4zWCBzagzzV7HybaefRdHvwoNGO197d8vc7h1wWzi1yrKgv p1ZWQsXpRVkOphh9fr1XhUuWYfK86DpQFWa7JjW8DEOVrx++pybGOMq73XgGfBlGhajX dkyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uSHNSUoc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2si19358645pla.22.2019.07.08.15.38.07; Mon, 08 Jul 2019 15:38:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uSHNSUoc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388814AbfGHP0X (ORCPT + 99 others); Mon, 8 Jul 2019 11:26:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:54116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388805AbfGHP0W (ORCPT ); Mon, 8 Jul 2019 11:26:22 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 192EE20665; Mon, 8 Jul 2019 15:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599581; bh=HvHBuw5vhtQrTQzI5wIOwi6sqkK0R/TKJ+aJRAfCSjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uSHNSUoc0zCMFwmKS/ae88XoDGAzyZE5lRB2Gs5c5FWcxdBPwPX6MVsGCfj6ExXCI 5Tx+yo6082VK3FbrYB0dOKx0sxsBGIHGnzxj7WgUlGPz+NNytx4khoLzRcK4sUkTxx CvkyEGV6K6WZH9QQVWabICHCGMMnN3V6K6khWjO8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , "J. Bruce Fields" Subject: [PATCH 4.14 52/56] svcrdma: Ignore source port when computing DRC hash Date: Mon, 8 Jul 2019 17:13:44 +0200 Message-Id: <20190708150524.139654936@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150514.376317156@linuxfoundation.org> References: <20190708150514.376317156@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuck Lever commit 1e091c3bbf51d34d5d96337a59ce5ab2ac3ba2cc upstream. The DRC appears to be effectively empty after an RPC/RDMA transport reconnect. The problem is that each connection uses a different source port, which defeats the DRC hash. Clients always have to disconnect before they send retransmissions to reset the connection's credit accounting, thus every retransmit on NFS/RDMA will miss the DRC. An NFS/RDMA client's IP source port is meaningless for RDMA transports. The transport layer typically sets the source port value on the connection to a random ephemeral port. The server already ignores it for the "secure port" check. See commit 16e4d93f6de7 ("NFSD: Ignore client's source port on RDMA transports"). The Linux NFS server's DRC resolves XID collisions from the same source IP address by using the checksum of the first 200 bytes of the RPC call header. Signed-off-by: Chuck Lever Cc: stable@vger.kernel.org # v4.14+ Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/xprtrdma/svc_rdma_transport.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c @@ -524,9 +524,14 @@ static void handle_connect_req(struct rd /* Save client advertised inbound read limit for use later in accept. */ newxprt->sc_ord = param->initiator_depth; - /* Set the local and remote addresses in the transport */ sa = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.dst_addr; svc_xprt_set_remote(&newxprt->sc_xprt, sa, svc_addr_len(sa)); + /* The remote port is arbitrary and not under the control of the + * client ULP. Set it to a fixed value so that the DRC continues + * to be effective after a reconnect. + */ + rpc_set_port((struct sockaddr *)&newxprt->sc_xprt.xpt_remote, 0); + sa = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.src_addr; svc_xprt_set_local(&newxprt->sc_xprt, sa, svc_addr_len(sa));