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: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I6e0aadcfd98e5cb77b362ef1a79e0eca2985f36e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11112
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2022-01-15 20:27:05 +09:00 committed by Tomasz Zawadzki
parent 9d1063d732
commit 8926303b59
2 changed files with 11 additions and 0 deletions

View File

@ -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;

View File

@ -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;
}