Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp170800imd; Wed, 31 Oct 2018 16:44:55 -0700 (PDT) X-Google-Smtp-Source: AJdET5ckQ5M73+axN1XSDLNFRgdvLUdXIPiKkqheOuVvSzrOG3PehOcqzrxPs60Z7AAblUJudtke X-Received: by 2002:a62:b802:: with SMTP id p2-v6mr5327146pfe.1.1541029495922; Wed, 31 Oct 2018 16:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029495; cv=none; d=google.com; s=arc-20160816; b=uA4cft5EAO6XZmmuZg67nethBjgAXrIF6u90C8/yOvvXaJrDFAuifXsg9tuJ0mNkgK 87aqgILLi5KsJ7YZMPUQMdBXRarDU+NaFZiS33EEcjLkJDXHodkV7i0Fdy1uFdQOs3kk PplxnRKpI2KqQp7ILO2lV11s/euMMix4zRn0fPGFCblJXevS66SD/Ms0JMkMeHECMcTO SJzVSeHwJqhhZuy/xijrAssl4ikD9Gf6XdJGbuTzsz/LRlLLbvWV9dgf7cDEFdhHNKFF cEPrhSVDe8zI7VEfFqkC7Bj80Mu5oXI22sjY445QiBYOXFr6viFMAeBZB2evz8YSOj1I Gj5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=COFMwt0pvmfTfsiZ8ZjX6ShjVNETzlsSVD/WoqBW+oU=; b=Vvrf4KObYZShgzDWp2PHpPo6NQLq1BnwfDF/VUxXRE2/TwC7BbhHoLySTAOQgmKJnC 98iCeHFYclKXHvychEBtVP4ta/s0iCF7lnEZ6lLOzCXEpzmY66/jBW2YqHrUffZGVoHt c/vB5zTPTROqNujb8fjM4CLQWuIT4TD4i4xDFMparX9Y92xP5MBiUBluSqOPv6Gn8gZS PcXkveUF0bJNrFKUbQIL27iUj8qJeR4RmogwUesSkM+GRa+GlRrgdsA0s37kYComv2y6 e1C9DMfWBe+6ySVDv27qb3jSd+mBbDwAtsbrJ1lq8PPp4BVOCQwMUgqx4rEY/E3zfC7L 9VvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="zwO7hdP/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4-v6si18679701pfb.43.2018.10.31.16.44.41; Wed, 31 Oct 2018 16:44:55 -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="zwO7hdP/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729003AbeKAIHg (ORCPT + 99 others); Thu, 1 Nov 2018 04:07:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:55456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727308AbeKAIHe (ORCPT ); Thu, 1 Nov 2018 04:07:34 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1164B20664; Wed, 31 Oct 2018 23:07:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027243; bh=/CwvahwV96iKOdOahg9iozHHRKRAOFxZxtm5qC/FAIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zwO7hdP/QT/4LJ/90MKZqlvULQPGrvgk9VASCpHbZea2DRshv6cuWItMxRxs0mCWZ vqocKzFKJkah0DahARfc4ojboG+e+6fU4AJc9ikPmCI7gFCQw6P7K74JRVBHsjlkiE sBL94v5VGnWUoXIhjhygcGAs2/1TqM2mbhVCfml8= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Chuck Lever , stable@kernel.org, Anna Schumaker , Sasha Levin Subject: [PATCH AUTOSEL 4.19 112/146] xprtrdma: Reset credit grant properly after a disconnect Date: Wed, 31 Oct 2018 19:05:07 -0400 Message-Id: <20181031230541.28822-112-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- net/sunrpc/xprtrdma/svc_rdma_backchannel.c | 1 + net/sunrpc/xprtrdma/transport.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c index a68180090554..b9827665ff35 100644 --- 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 diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 143ce2579ba9..98cbc7b060ba 100644 --- 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; } /** -- 2.17.1