lib/nvme: add checks for new states in reconnect_io_qpair.

This function hasn't kept up properly with the states that
we use for tracking the qpair lifecycle.

Add checks for NVME_QPAIR_DISCONNECTING and NVME_QPAIR_DESTROYING.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I51607d4f00e94937b08fca28e766163580d46461
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3359
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Seth Howell 2020-07-15 10:26:06 -07:00 committed by Jim Harris
parent 757eddeb59
commit c9bc86c061

View File

@ -463,6 +463,7 @@ int
spdk_nvme_ctrlr_reconnect_io_qpair(struct spdk_nvme_qpair *qpair) spdk_nvme_ctrlr_reconnect_io_qpair(struct spdk_nvme_qpair *qpair)
{ {
struct spdk_nvme_ctrlr *ctrlr; struct spdk_nvme_ctrlr *ctrlr;
enum nvme_qpair_state qpair_state;
int rc; int rc;
assert(qpair != NULL); assert(qpair != NULL);
@ -471,23 +472,24 @@ spdk_nvme_ctrlr_reconnect_io_qpair(struct spdk_nvme_qpair *qpair)
ctrlr = qpair->ctrlr; ctrlr = qpair->ctrlr;
nvme_robust_mutex_lock(&ctrlr->ctrlr_lock); nvme_robust_mutex_lock(&ctrlr->ctrlr_lock);
qpair_state = nvme_qpair_get_state(qpair);
if (ctrlr->is_removed) { if (ctrlr->is_removed) {
rc = -ENODEV; rc = -ENODEV;
goto out; goto out;
} }
if (ctrlr->is_resetting) { if (ctrlr->is_resetting || qpair_state == NVME_QPAIR_DISCONNECTING) {
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
if (ctrlr->is_failed) { if (ctrlr->is_failed || qpair_state == NVME_QPAIR_DESTROYING) {
rc = -ENXIO; rc = -ENXIO;
goto out; goto out;
} }
if (nvme_qpair_get_state(qpair) != NVME_QPAIR_DISCONNECTED) { if (qpair_state != NVME_QPAIR_DISCONNECTED) {
rc = 0; rc = 0;
goto out; goto out;
} }