Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3482272imu; Sun, 11 Nov 2018 16:06:32 -0800 (PST) X-Google-Smtp-Source: AJdET5cLvNdnfIoXTRYJeUx1ZoRFxVzW1UFr03n37+nO7pcfCbPFU3ocv1XMlPYtgaR2qNznBTWE X-Received: by 2002:a17:902:1123:: with SMTP id d32-v6mr14062845pla.62.1541981192503; Sun, 11 Nov 2018 16:06:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981192; cv=none; d=google.com; s=arc-20160816; b=bh3nhcYBNEVAZyi5c1IzG7sKskilP0KzlaMKaqnPORU2+J2CZlpa6uz7u9jLYLpADH bZBn+sff+zBYl5HTNy12lEYFrHqIcQ63B/LXps73dcc5R3BiylEP6N/vlXRuUwEejuRL E25/0RWfPGS1fo1VBaIgtrrPTH3T2TaHcdc5GRXYvgWTXRp4hNfu9qfCrUGTN8vxDr6Y UrWA2tEk0Yh47Xa/p5uCFwAn9t9ZFU4JdUbL/KOuyj98lIcxOBd7x7Zv2idoawwYruU+ C15AE9s4SiTYLtcyYd6u4HrSrdgfdofwPiNxwuf+AT6JsGlLTb5kmhfDizbNBP7cI5bp 5rag== 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=s2H4QJnSNHlZH3I0nr9HtL+macQu6fTItdVfPd4Su8Y=; b=b1bhSdYi6HLCSiZrVfJwP4dEuQq+pL2cWdpgm9vnCxC3U3PXFMDsXwkaZbhRzpim84 +ACKu8Nxt8qo6MFk7Yox2tcsq39Ci8j+J9P1MUBhrFZlVfTI9HjVgEh+yVv/3coP7T4M MaOFSL+syjEfWMGnnnppxQZgDW+8SbvVbcd27+SAMhSEysEDQjI6OLyHLYU7Rd1u9I48 TTW4aoLlxXCqpcnPfLfYQZuYLCc1TYxpqFK/Vz2DCnOJVrZBG0hnVxhoohAT2htr8y3e EXL3cckwT5Cmeg1RKe2ayhvodk5ICCw+ZbUjZSrYkzwd5jbrR3G67OJ8C6uww3pheBo3 LcgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u9D0Y4uS; 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 88-v6si15905908plc.34.2018.11.11.16.06.17; Sun, 11 Nov 2018 16:06:32 -0800 (PST) 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=u9D0Y4uS; 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 S1732202AbeKLJ4V (ORCPT + 99 others); Mon, 12 Nov 2018 04:56:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:34210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731593AbeKLIRl (ORCPT ); Mon, 12 Nov 2018 03:17:41 -0500 Received: from localhost (unknown [206.108.79.134]) (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 E9D762241B; Sun, 11 Nov 2018 22:27:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975266; bh=9C6DW0W3oLensNQNCRygRzHuXIuvMhOTz0BX6AkE2Ug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u9D0Y4uS4CLS7KALZOOQghSPcn0nkQgLneMXDuDsJf1rcunT/1uw5wfiCqri+P1ca QsZzzlAUgaZ6J8YUUt0tH7DIxHXxXolz6LYyI1Up60F52ETGgHV3AdJ5gBU+RoN/HD hq+c5jLadHuFjYkpWVNAiSRgKLPrNAMoIXxJvB3I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , stable@kernel.org, Anna Schumaker , Sasha Levin Subject: [PATCH 4.19 156/361] xprtrdma: Reset credit grant properly after a disconnect Date: Sun, 11 Nov 2018 14:18:23 -0800 Message-Id: <20181111221642.364842589@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chuck Lever [ Upstream commit ef739b2175dde9c05594f768cb78149f1ce2ac36 ] On a fresh connection, an RPC/RDMA client is supposed to send only one RPC Call until it gets a credit grant in the first RPC Reply from the server [RFC 8166, Section 3.3.3]. There is a bug in the Linux client's credit accounting mechanism introduced by commit e7ce710a8802 ("xprtrdma: Avoid deadlock when credit window is reset"). On connect, it simply dumps all pending RPC Calls onto the new connection. Servers have been tolerant of this bad behavior. Currently no server implementation ever changes its credit grant over reconnects, and servers always repost enough Receives before connections are fully established. To correct this issue, ensure that the client resets both the credit grant _and_ the congestion window when handling a reconnect. Fixes: e7ce710a8802 ("xprtrdma: Avoid deadlock when credit ... ") Signed-off-by: Chuck Lever Cc: stable@kernel.org Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/xprtrdma/svc_rdma_backchannel.c | 1 + net/sunrpc/xprtrdma/transport.c | 6 ++++++ 2 files changed, 7 insertions(+) --- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c +++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c @@ -248,6 +248,7 @@ static void xprt_rdma_bc_close(struct rpc_xprt *xprt) { dprintk("svcrdma: %s: xprt %p\n", __func__, xprt); + xprt->cwnd = RPC_CWNDSHIFT; } static void --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c @@ -468,6 +468,12 @@ xprt_rdma_close(struct rpc_xprt *xprt) xprt->reestablish_timeout = 0; xprt_disconnect_done(xprt); rpcrdma_ep_disconnect(ep, ia); + + /* Prepare @xprt for the next connection by reinitializing + * its credit grant to one (see RFC 8166, Section 3.3.3). + */ + r_xprt->rx_buf.rb_credits = 1; + xprt->cwnd = RPC_CWNDSHIFT; } /**