xprtrdma: Do not leak an MW during a DMA map failure
authorChuck Lever <chuck.lever@oracle.com>
Wed, 29 Jun 2016 17:53:02 +0000 (13:53 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 11 Jul 2016 19:50:43 +0000 (15:50 -0400)
Based on code audit.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/fmr_ops.c
net/sunrpc/xprtrdma/frwr_ops.c

index 4837ced20b65c5cd7e5ba4c01bbbb1186ba4dfa5..6c4527b6c3ca0d2d25699e4ca3e75c5d76be3c21 100644 (file)
@@ -257,6 +257,7 @@ fmr_op_map(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg,
 out_dmamap_err:
        pr_err("rpcrdma: failed to dma map sg %p sg_nents %u\n",
               mw->mw_sg, mw->mw_nents);
+       rpcrdma_defer_mr_recovery(mw);
        return -ENOMEM;
 
 out_maperr:
index cbb2d05be57fbc794b9a0ddca46237da4ebd01b3..c9ead2b01b66f22d135ae830cd920289aa5b34c8 100644 (file)
@@ -438,6 +438,7 @@ frwr_op_map(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg,
 out_dmamap_err:
        pr_err("rpcrdma: failed to dma map sg %p sg_nents %u\n",
               mw->mw_sg, mw->mw_nents);
+       rpcrdma_defer_mr_recovery(mw);
        return -ENOMEM;
 
 out_mapmr_err: