Commit 8926303b authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

nvme: Caller polls qpair until disconnected if async connect failed



nvme_transport_ctrlr_connect_qpair() calls
nvme_transport_ctrlr_disconnect_qpair() if failed.

If async qpair disconnect is supported, even when connect qpair failed,
nvme_transport_ctrlr_connect_qpair() may complete asynchronously later.

The cases that qpair->async is set to true are I/O qpair for the NVMe
bdev module and admin qpair.

example/nvme/perf and example/nvme/reconnect use I/O qpair but both
set qpair->async to false.

For the NVMe bdev module, I/O qpair is connected when creating I/O
channel or resetting ctrlr. If spdk_nvme_ctrlr_connect_io_qpair()
returns 0 for a I/O qpair, the qpair is in a poll group and is polled
by spdk_nvme_poll_group_process_completions() and a disconnected
callback is called to the qpair. Hence we do not need to add additional
polling for I/O qpair in the NVMe bdev module.

Signed-off-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I6e0aadcfd98e5cb77b362ef1a79e0eca2985f36e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11112


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 9d1063d7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3793,6 +3793,11 @@ nvme_ctrlr_process_init(struct spdk_nvme_ctrlr *ctrlr)
			 */
			nvme_qpair_abort_queued_reqs(ctrlr->adminq, 0);
			break;
		case NVME_QPAIR_DISCONNECTING:
			assert(ctrlr->adminq->async == true);
			break;
		case NVME_QPAIR_DISCONNECTED:
		/* fallthrough */
		default:
			nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_ERROR, NVME_TIMEOUT_INFINITE);
			break;
+6 −0
Original line number Diff line number Diff line
@@ -514,6 +514,12 @@ nvme_transport_ctrlr_connect_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nv
	return 0;
err:
	nvme_transport_connect_qpair_fail(qpair, NULL);
	if (nvme_qpair_get_state(qpair) == NVME_QPAIR_DISCONNECTING) {
		assert(qpair->async == true);
		/* Let the caller to poll the qpair until it is actually disconnected. */
		return 0;
	}

	return rc;
}