ut/bdev_nvme: Manage adminq's state and return -ENXIO if adminq is disconnected

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I81d4a8ce5c487449ab634bcd4f984d6867febf35
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10949
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: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Shuhei Matsumoto 2022-01-03 11:22:40 +09:00 committed by Tomasz Zawadzki
parent 49b8d1f33a
commit 3185df9057

View File

@ -401,6 +401,7 @@ ut_attach_ctrlr(const struct spdk_nvme_transport_id *trid, uint32_t num_ns,
ctrlr->attached = true;
ctrlr->adminq.ctrlr = ctrlr;
TAILQ_INIT(&ctrlr->adminq.outstanding_reqs);
ctrlr->adminq.is_connected = true;
if (num_ns != 0) {
ctrlr->num_ns = num_ns;
@ -776,6 +777,7 @@ spdk_nvme_ctrlr_reconnect_poll_async(struct spdk_nvme_ctrlr *ctrlr)
return -EIO;
}
ctrlr->adminq.is_connected = true;
return 0;
}
@ -787,6 +789,7 @@ spdk_nvme_ctrlr_reconnect_async(struct spdk_nvme_ctrlr *ctrlr)
int
spdk_nvme_ctrlr_disconnect(struct spdk_nvme_ctrlr *ctrlr)
{
ctrlr->adminq.is_connected = false;
ctrlr->is_failed = false;
return 0;
@ -1092,6 +1095,10 @@ spdk_nvme_qpair_process_completions(struct spdk_nvme_qpair *qpair,
struct ut_nvme_req *req, *tmp;
uint32_t num_completions = 0;
if (!qpair->is_connected) {
return -ENXIO;
}
qpair->in_completion_context = true;
TAILQ_FOREACH_SAFE(req, &qpair->outstanding_reqs, tailq, tmp) {