aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_transport.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index 028c6cf89364..31b1927b5ee6 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -279,6 +279,8 @@ static void rq_comp_handler(struct ib_cq *cq, void *cq_context)
279 * 279 *
280 * Take all completing WC off the CQE and enqueue the associated DTO 280 * Take all completing WC off the CQE and enqueue the associated DTO
281 * context on the dto_q for the transport. 281 * context on the dto_q for the transport.
282 *
283 * Note that caller must hold a transport reference.
282 */ 284 */
283static void rq_cq_reap(struct svcxprt_rdma *xprt) 285static void rq_cq_reap(struct svcxprt_rdma *xprt)
284{ 286{
@@ -298,13 +300,16 @@ static void rq_cq_reap(struct svcxprt_rdma *xprt)
298 ctxt->byte_len = wc.byte_len; 300 ctxt->byte_len = wc.byte_len;
299 if (wc.status != IB_WC_SUCCESS) { 301 if (wc.status != IB_WC_SUCCESS) {
300 /* Close the transport */ 302 /* Close the transport */
303 dprintk("svcrdma: transport closing putting ctxt %p\n", ctxt);
301 set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags); 304 set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags);
302 svc_rdma_put_context(ctxt, 1); 305 svc_rdma_put_context(ctxt, 1);
306 svc_xprt_put(&xprt->sc_xprt);
303 continue; 307 continue;
304 } 308 }
305 spin_lock_bh(&xprt->sc_rq_dto_lock); 309 spin_lock_bh(&xprt->sc_rq_dto_lock);
306 list_add_tail(&ctxt->dto_q, &xprt->sc_rq_dto_q); 310 list_add_tail(&ctxt->dto_q, &xprt->sc_rq_dto_q);
307 spin_unlock_bh(&xprt->sc_rq_dto_lock); 311 spin_unlock_bh(&xprt->sc_rq_dto_lock);
312 svc_xprt_put(&xprt->sc_xprt);
308 } 313 }
309 314
310 if (ctxt) 315 if (ctxt)
@@ -322,6 +327,8 @@ static void rq_cq_reap(struct svcxprt_rdma *xprt)
322 327
323/* 328/*
324 * Send Queue Completion Handler - potentially called on interrupt context. 329 * Send Queue Completion Handler - potentially called on interrupt context.
330 *
331 * Note that caller must hold a transport reference.
325 */ 332 */
326static void sq_cq_reap(struct svcxprt_rdma *xprt) 333static void sq_cq_reap(struct svcxprt_rdma *xprt)
327{ 334{
@@ -374,6 +381,7 @@ static void sq_cq_reap(struct svcxprt_rdma *xprt)
374 wc.opcode, wc.status); 381 wc.opcode, wc.status);
375 break; 382 break;
376 } 383 }
384 svc_xprt_put(&xprt->sc_xprt);
377 } 385 }
378 386
379 if (ctxt) 387 if (ctxt)
@@ -530,9 +538,12 @@ int svc_rdma_post_recv(struct svcxprt_rdma *xprt)
530 recv_wr.num_sge = ctxt->count; 538 recv_wr.num_sge = ctxt->count;
531 recv_wr.wr_id = (u64)(unsigned long)ctxt; 539 recv_wr.wr_id = (u64)(unsigned long)ctxt;
532 540
541 svc_xprt_get(&xprt->sc_xprt);
533 ret = ib_post_recv(xprt->sc_qp, &recv_wr, &bad_recv_wr); 542 ret = ib_post_recv(xprt->sc_qp, &recv_wr, &bad_recv_wr);
534 if (ret) 543 if (ret) {
544 svc_xprt_put(&xprt->sc_xprt);
535 svc_rdma_put_context(ctxt, 1); 545 svc_rdma_put_context(ctxt, 1);
546 }
536 return ret; 547 return ret;
537} 548}
538 549
@@ -1049,14 +1060,17 @@ int svc_rdma_send(struct svcxprt_rdma *xprt, struct ib_send_wr *wr)
1049 continue; 1060 continue;
1050 } 1061 }
1051 /* Bumped used SQ WR count and post */ 1062 /* Bumped used SQ WR count and post */
1063 svc_xprt_get(&xprt->sc_xprt);
1052 ret = ib_post_send(xprt->sc_qp, wr, &bad_wr); 1064 ret = ib_post_send(xprt->sc_qp, wr, &bad_wr);
1053 if (!ret) 1065 if (!ret)
1054 atomic_inc(&xprt->sc_sq_count); 1066 atomic_inc(&xprt->sc_sq_count);
1055 else 1067 else {
1068 svc_xprt_put(&xprt->sc_xprt);
1056 dprintk("svcrdma: failed to post SQ WR rc=%d, " 1069 dprintk("svcrdma: failed to post SQ WR rc=%d, "
1057 "sc_sq_count=%d, sc_sq_depth=%d\n", 1070 "sc_sq_count=%d, sc_sq_depth=%d\n",
1058 ret, atomic_read(&xprt->sc_sq_count), 1071 ret, atomic_read(&xprt->sc_sq_count),
1059 xprt->sc_sq_depth); 1072 xprt->sc_sq_depth);
1073 }
1060 spin_unlock_bh(&xprt->sc_lock); 1074 spin_unlock_bh(&xprt->sc_lock);
1061 break; 1075 break;
1062 } 1076 }