Commit b874f657 authored by Seth Howell's avatar Seth Howell Committed by Jim Harris
Browse files

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



Signed-off-by: default avatarSeth 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: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 6338af34
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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;
}

+3 −0
Original line number Diff line number Diff line
@@ -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)