|
62 | 62 | #endif
|
63 | 63 |
|
64 | 64 | static void rpcrdma_reset_frmrs(struct rpcrdma_ia *);
|
| 65 | +static void rpcrdma_reset_fmrs(struct rpcrdma_ia *); |
65 | 66 |
|
66 | 67 | /*
|
67 | 68 | * internal functions
|
@@ -868,8 +869,19 @@ rpcrdma_ep_connect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
|
868 | 869 | rpcrdma_ep_disconnect(ep, ia);
|
869 | 870 | rpcrdma_flush_cqs(ep);
|
870 | 871 |
|
871 |
| - if (ia->ri_memreg_strategy == RPCRDMA_FRMR) |
| 872 | + switch (ia->ri_memreg_strategy) { |
| 873 | + case RPCRDMA_FRMR: |
872 | 874 | rpcrdma_reset_frmrs(ia);
|
| 875 | + break; |
| 876 | + case RPCRDMA_MTHCAFMR: |
| 877 | + rpcrdma_reset_fmrs(ia); |
| 878 | + break; |
| 879 | + case RPCRDMA_ALLPHYSICAL: |
| 880 | + break; |
| 881 | + default: |
| 882 | + rc = -EIO; |
| 883 | + goto out; |
| 884 | + } |
873 | 885 |
|
874 | 886 | xprt = container_of(ia, struct rpcrdma_xprt, rx_ia);
|
875 | 887 | id = rpcrdma_create_id(xprt, ia,
|
@@ -1289,6 +1301,34 @@ rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf)
|
1289 | 1301 | kfree(buf->rb_pool);
|
1290 | 1302 | }
|
1291 | 1303 |
|
| 1304 | +/* After a disconnect, unmap all FMRs. |
| 1305 | + * |
| 1306 | + * This is invoked only in the transport connect worker in order |
| 1307 | + * to serialize with rpcrdma_register_fmr_external(). |
| 1308 | + */ |
| 1309 | +static void |
| 1310 | +rpcrdma_reset_fmrs(struct rpcrdma_ia *ia) |
| 1311 | +{ |
| 1312 | + struct rpcrdma_xprt *r_xprt = |
| 1313 | + container_of(ia, struct rpcrdma_xprt, rx_ia); |
| 1314 | + struct rpcrdma_buffer *buf = &r_xprt->rx_buf; |
| 1315 | + struct list_head *pos; |
| 1316 | + struct rpcrdma_mw *r; |
| 1317 | + LIST_HEAD(l); |
| 1318 | + int rc; |
| 1319 | + |
| 1320 | + list_for_each(pos, &buf->rb_all) { |
| 1321 | + r = list_entry(pos, struct rpcrdma_mw, mw_all); |
| 1322 | + |
| 1323 | + INIT_LIST_HEAD(&l); |
| 1324 | + list_add(&r->r.fmr->list, &l); |
| 1325 | + rc = ib_unmap_fmr(&l); |
| 1326 | + if (rc) |
| 1327 | + dprintk("RPC: %s: ib_unmap_fmr failed %i\n", |
| 1328 | + __func__, rc); |
| 1329 | + } |
| 1330 | +} |
| 1331 | + |
1292 | 1332 | /* After a disconnect, a flushed FAST_REG_MR can leave an FRMR in
|
1293 | 1333 | * an unusable state. Find FRMRs in this state and dereg / reg
|
1294 | 1334 | * each. FRMRs that are VALID and attached to an rpcrdma_req are
|
|
0 commit comments