Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1909621pxb; Thu, 16 Sep 2021 19:57:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw20nEDWGlwrVEt1FgYtvsOIxQgesEWCcxDWlVFWmpKhJlmX9fxnHkQ2Tk4VUkwSfURPnBm X-Received: by 2002:a05:6402:4247:: with SMTP id g7mr10015364edb.287.1631847442947; Thu, 16 Sep 2021 19:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631847442; cv=none; d=google.com; s=arc-20160816; b=gvdf/gswR3t7VbXqVtPFpP5vWVm24dz/kq0oKnMVi+09LvLpOEfqfp6gfyGxFMH5Ja Uuoyn8mdVg6mJkP2XwPrBiPcsyQpJBZdp4Byo1HAUsR5LW2QQykmllKqrVYj3a2tyso1 zg9h4BAHlaC8f6r8Fg0ngN7k4eEizPUfARvgt9ZOpQ4Xt3+37LQpIuM0P3FcqOyFrmOS Fpmp+8cavwSMZf4PLm51LbuzCjeZDhaxLRTjqVGYEWa8BAmxtFyBna2i2iNPPDEgnsay 3EfCK0hiwo5IYE+D+vwK309S5QqtTJ7BJjqf10RQJphhGTTJ5m+KQ8457uTldEpNxf9+ FxzQ== 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:subject:cc:to :from:dkim-signature; bh=7hvqWLUj1b7Bl8n/QGOF6SczMqtPXVQd/aeRNSY6l+E=; b=0cUG3Ln+uyNqTov55fz8vx7UTkIlc5V6tpbfeS4wRsZJi9m9q1pxQin9lzMYh3g+Wf sOLUvNpJfiP/v4DP6L/3DN6hYjcEpgTBV6vTZ/P8PlZvFq9v7nxqXqMIrwT/nUyE5fIh jRZGwss0czjjX61wagc1TEh6lvM5WZqk2LJulQaADz1uJzGnbF7hq2XwuCw0IuuEmuiw B8EwnGi8yM/UNZc/kpX72o92AFd5VIWuGzO+052nWwhnTiuT88wu0Koha0c7VSz/gNHx 7gD/ZS5IsABC4xpIOedsPHjma5UGGCRmLfy6QtUdCTpBlnv4WccmrBbnL5pH/MUUZACD 3NJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zw0NyNKF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bj25si5898332ejb.201.2021.09.16.19.56.58; Thu, 16 Sep 2021 19:57:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=Zw0NyNKF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352151AbhIPRUo (ORCPT + 99 others); Thu, 16 Sep 2021 13:20:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:41018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344401AbhIPRNX (ORCPT ); Thu, 16 Sep 2021 13:13:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E0CF161B56; Thu, 16 Sep 2021 16:38:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631810333; bh=5BK9XdaeTZ82lpNiUBDQYwONct9Gtl02nQ2vZYZaTXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zw0NyNKFlYuNRhYW1H1e4MYN5iUhrxfLNDz5AWEXmUI9EgQV9u222T7DJyjyrW9qp mLt5qWqv4AWSxbJZG5PnvHfdzkodPrmx2ZAIYiWTYspGxjuG6+3Sz9Jjiu75+oTe/a FuVtOYJC1zC0AtO7B1Q1Mjvg4yCapQHAOrWp47X4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Anna Schumaker , Sasha Levin Subject: [PATCH 5.14 103/432] xprtrdma: Put rpcrdma_reps before waking the tear-down completion Date: Thu, 16 Sep 2021 17:57:32 +0200 Message-Id: <20210916155814.268217925@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155810.813340753@linuxfoundation.org> References: <20210916155810.813340753@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuck Lever [ Upstream commit 97480cae13ca3a9c1de3eb6fd66cf9650a60db42 ] Ensure the tear-down completion is awoken only /after/ we've stopped fiddling with rpcrdma_rep objects in rpcrdma_post_recvs(). Fixes: 15788d1d1077 ("xprtrdma: Do not refresh Receive Queue while it is draining") Signed-off-by: Chuck Lever Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- net/sunrpc/xprtrdma/verbs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 649c23518ec0..5a11e318a0d9 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -1416,11 +1416,6 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, int needed, bool temp) rc = ib_post_recv(ep->re_id->qp, wr, (const struct ib_recv_wr **)&bad_wr); - if (atomic_dec_return(&ep->re_receiving) > 0) - complete(&ep->re_done); - -out: - trace_xprtrdma_post_recvs(r_xprt, count, rc); if (rc) { for (wr = bad_wr; wr;) { struct rpcrdma_rep *rep; @@ -1431,6 +1426,11 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, int needed, bool temp) --count; } } + if (atomic_dec_return(&ep->re_receiving) > 0) + complete(&ep->re_done); + +out: + trace_xprtrdma_post_recvs(r_xprt, count, rc); ep->re_receive_count += count; return; } -- 2.30.2