diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index 2b1931752..c23d2d17c 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -486,6 +486,11 @@ request_transfer_in(struct spdk_nvmf_request *req) rc = ibv_post_send(rqpair->cm_id->qp, &rdma_req->data.wr, &bad_wr); if (rc) { SPDK_ERRLOG("Unable to transfer data from host to target\n"); + + /* Decrement r/w counter back since data transfer + * has not started. + */ + rqpair->cur_rdma_rw_depth--; return -1; } @@ -552,6 +557,13 @@ request_transfer_out(struct spdk_nvmf_request *req) rc = ibv_post_send(rqpair->cm_id->qp, send_wr, &bad_send_wr); if (rc) { SPDK_ERRLOG("Unable to send response capsule\n"); + + if (rdma_req->data.wr.opcode == IBV_WR_RDMA_WRITE) { + /* Decrement r/w counter back since data transfer + * has not started. + */ + rqpair->cur_rdma_rw_depth--; + } } return rc;