]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xprtrdma: Put rpcrdma_reps before waking the tear-down completion
authorChuck Lever <chuck.lever@oracle.com>
Mon, 2 Aug 2021 18:44:24 +0000 (14:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:41:52 +0000 (13:41 +0200)
[ 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 <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sunrpc/xprtrdma/verbs.c

index 649c23518ec042285a12159b498c06359ffc49f2..5a11e318a0d9904a01607d6768207d0791e2012d 100644 (file)
@@ -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 @@ out:
                        --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;
 }