Commit b9526681 authored by Seth Howell's avatar Seth Howell Committed by Ben Walker
Browse files

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: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/443470


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 825cac27
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -2593,6 +2593,13 @@ spdk_nvmf_rdma_poll_group_destroy(struct spdk_nvmf_transport_poll_group *group)
	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
spdk_nvmf_rdma_poll_group_add(struct spdk_nvmf_transport_poll_group *group,
			      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);
	if (rc) {
		/* 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_destroy(rqpair);
		spdk_nvmf_rdma_qpair_reject_connection(rqpair);
		return -1;
	}

@@ -2691,6 +2697,17 @@ spdk_nvmf_rdma_close_qpair(struct spdk_nvmf_qpair *qpair)

	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) {
		spdk_nvmf_rdma_set_ibv_state(rqpair, IBV_QPS_ERR);
	}