lib/nvme: disconnect qpairs if they are failed during reset.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I15079cb35d48221bd92b7ca41766148fdb58e668
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1855
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Seth Howell 2020-04-14 15:47:47 -07:00 committed by Jim Harris
parent 6338af34fc
commit b874f65743
2 changed files with 19 additions and 0 deletions

View File

@ -429,6 +429,22 @@ nvme_qpair_check_enabled(struct spdk_nvme_qpair *qpair)
}
}
/*
* When doing a reset, we must disconnect the qpair on the proper core.
* Note, reset is the only case where we set the failure reason without
* setting the qpair state since reset is done at the generic layer on the
* controller thread and we can't disconnect I/O qpairs from the controller
* thread.
*/
if (qpair->transport_failure_reason != SPDK_NVME_QPAIR_FAILURE_NONE &&
nvme_qpair_get_state(qpair) == NVME_QPAIR_ENABLED) {
/* Don't disconnect PCIe qpairs. They are a special case for reset. */
if (qpair->ctrlr->trid.trtype != SPDK_NVME_TRANSPORT_PCIE) {
nvme_ctrlr_disconnect_qpair(qpair);
}
return false;
}
return nvme_qpair_get_state(qpair) == NVME_QPAIR_ENABLED;
}

View File

@ -52,6 +52,9 @@ DEFINE_STUB_V(nvme_transport_qpair_abort_reqs, (struct spdk_nvme_qpair *qpair, u
DEFINE_STUB(nvme_transport_qpair_submit_request, int,
(struct spdk_nvme_qpair *qpair, struct nvme_request *req), 0);
DEFINE_STUB(spdk_nvme_ctrlr_free_io_qpair, int, (struct spdk_nvme_qpair *qpair), 0);
DEFINE_STUB_V(nvme_transport_ctrlr_disconnect_qpair, (struct spdk_nvme_ctrlr *ctrlr,
struct spdk_nvme_qpair *qpair));
DEFINE_STUB_V(nvme_ctrlr_disconnect_qpair, (struct spdk_nvme_qpair *qpair));
void
nvme_ctrlr_fail(struct spdk_nvme_ctrlr *ctrlr, bool hot_remove)