rdma: destroy uninitialized qpairs immediately.

Connections in the uninitialized state haven't been added to a poll
group yet, so submitting dummy requests to them will be pointless since
they will never be polled. We need to reject the connection and destroy
the qpair immediately.

Change-Id: Id5dd711882e1ae7c13ae32c06da2285186b00a1b
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/443470
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Seth Howell 2019-02-05 12:50:41 -07:00 committed by Ben Walker
parent 825cac2720
commit b952668186

View File

@ -2593,6 +2593,13 @@ spdk_nvmf_rdma_poll_group_destroy(struct spdk_nvmf_transport_poll_group *group)
free(rgroup); free(rgroup);
} }
static void
spdk_nvmf_rdma_qpair_reject_connection(struct spdk_nvmf_rdma_qpair *rqpair)
{
spdk_nvmf_rdma_event_reject(rqpair->cm_id, SPDK_NVMF_RDMA_ERROR_NO_RESOURCES);
spdk_nvmf_rdma_qpair_destroy(rqpair);
}
static int static int
spdk_nvmf_rdma_poll_group_add(struct spdk_nvmf_transport_poll_group *group, spdk_nvmf_rdma_poll_group_add(struct spdk_nvmf_transport_poll_group *group,
struct spdk_nvmf_qpair *qpair) struct spdk_nvmf_qpair *qpair)
@ -2631,8 +2638,7 @@ spdk_nvmf_rdma_poll_group_add(struct spdk_nvmf_transport_poll_group *group,
rc = spdk_nvmf_rdma_event_accept(rqpair->cm_id, rqpair); rc = spdk_nvmf_rdma_event_accept(rqpair->cm_id, rqpair);
if (rc) { if (rc) {
/* Try to reject, but we probably can't */ /* Try to reject, but we probably can't */
spdk_nvmf_rdma_event_reject(rqpair->cm_id, SPDK_NVMF_RDMA_ERROR_NO_RESOURCES); spdk_nvmf_rdma_qpair_reject_connection(rqpair);
spdk_nvmf_rdma_qpair_destroy(rqpair);
return -1; return -1;
} }
@ -2691,6 +2697,17 @@ spdk_nvmf_rdma_close_qpair(struct spdk_nvmf_qpair *qpair)
rqpair->disconnect_flags |= RDMA_QP_DISCONNECTING; rqpair->disconnect_flags |= RDMA_QP_DISCONNECTING;
/* This happens only when the qpair is disconnected before
* it is added to the poll group. SInce there is no poll group,
* we will never reap the I/O for this connection. This also
* means that we have not accepted the connection request yet,
* so we need to reject it.
*/
if (rqpair->qpair.state == SPDK_NVMF_QPAIR_UNINITIALIZED) {
spdk_nvmf_rdma_qpair_reject_connection(rqpair);
return;
}
if (rqpair->ibv_attr.qp_state != IBV_QPS_ERR) { if (rqpair->ibv_attr.qp_state != IBV_QPS_ERR) {
spdk_nvmf_rdma_set_ibv_state(rqpair, IBV_QPS_ERR); spdk_nvmf_rdma_set_ibv_state(rqpair, IBV_QPS_ERR);
} }