]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
xprtrdma: Fix FRWR invalidation error recovery
authorChuck Lever <chuck.lever@oracle.com>
Thu, 8 Jun 2017 15:52:28 +0000 (11:52 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 13 Jul 2017 20:00:11 +0000 (16:00 -0400)
When ib_post_send() fails, all LOCAL_INV WRs past @bad_wr have to be
examined, and the MRs reset by hand.

I'm not sure how the existing code can work by comparing R_keys.
Restructure the logic so that instead it walks the chain of WRs,
starting from the first bad one.

Make sure to wait for completion if at least one WR was actually
posted. Otherwise, if the ib_post_send fails, we can end up
DMA-unmapping the MR while LOCAL_INV operations are in flight.

Commit 7a89f9c626e3 ("xprtrdma: Honor ->send_request API contract")
added the rdma_disconnect() call site. The disconnect actually
causes more problems than it solves, and SQ overruns happen only as
a result of software bugs. So remove it.

Fixes: d7a21c1bed54 ("xprtrdma: Reset MRs in frwr_op_unmap_sync()")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/frwr_ops.c

index 97f9f85fa5c1a700641b919a41422e3af2d2213b..24631e0edadbbcbc7c8b9ad380be7bbf664a0030 100644 (file)
@@ -521,12 +521,13 @@ frwr_op_unmap_sync(struct rpcrdma_xprt *r_xprt, struct list_head *mws)
         * unless ri_id->qp is a valid pointer.
         */
        r_xprt->rx_stats.local_inv_needed++;
+       bad_wr = NULL;
        rc = ib_post_send(ia->ri_id->qp, first, &bad_wr);
+       if (bad_wr != first)
+               wait_for_completion(&f->fr_linv_done);
        if (rc)
                goto reset_mrs;
 
-       wait_for_completion(&f->fr_linv_done);
-
        /* ORDER: Now DMA unmap all of the MRs, and return
         * them to the free MW list.
         */
@@ -543,17 +544,19 @@ unmap:
 
 reset_mrs:
        pr_err("rpcrdma: FRMR invalidate ib_post_send returned %i\n", rc);
-       rdma_disconnect(ia->ri_id);
 
        /* Find and reset the MRs in the LOCAL_INV WRs that did not
-        * get posted. This is synchronous, and slow.
+        * get posted.
         */
-       list_for_each_entry(mw, mws, mw_list) {
-               f = &mw->frmr;
-               if (mw->mw_handle == bad_wr->ex.invalidate_rkey) {
-                       __frwr_reset_mr(ia, mw);
-                       bad_wr = bad_wr->next;
-               }
+       rpcrdma_init_cqcount(&r_xprt->rx_ep, -count);
+       while (bad_wr) {
+               f = container_of(bad_wr, struct rpcrdma_frmr,
+                                fr_invwr);
+               mw = container_of(f, struct rpcrdma_mw, frmr);
+
+               __frwr_reset_mr(ia, mw);
+
+               bad_wr = bad_wr->next;
        }
        goto unmap;
 }