svcrdma: Drain QP before freeing svcrdma_xprt
authorChuck Lever <chuck.lever@oracle.com>
Wed, 4 May 2016 14:53:30 +0000 (10:53 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 13 May 2016 19:53:06 +0000 (15:53 -0400)
If the server has forced a disconnect, the associated QP has not
been moved to the Error state, and thus Receives are still posted.

Ensure Receives (and any other outstanding WRs) are drained to
release resources that can be freed during teardown of the
svcrdma_xprt.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
net/sunrpc/xprtrdma/svc_rdma_transport.c

index 02a112c7cb6ac278aa37e5e7770460fd47b16493..dd9440137834c7b1a55b433a1a91bb52efa26acc 100644 (file)
@@ -1180,6 +1180,9 @@ static void __svc_rdma_free(struct work_struct *work)
 
        dprintk("svcrdma: %s(%p)\n", __func__, rdma);
 
+       if (rdma->sc_qp && !IS_ERR(rdma->sc_qp))
+               ib_drain_qp(rdma->sc_qp);
+
        /* We should only be called from kref_put */
        if (atomic_read(&xprt->xpt_ref.refcount) != 0)
                pr_err("svcrdma: sc_xprt still in use? (%d)\n",