Commit 5f3e922a authored by Cunyin Chang's avatar Cunyin Chang Committed by Jim Harris
Browse files

nvme: Fail the qpair if it is marked as failure when process the completion queue.



This make sure the qpair failure could be started from upper level application.

Change-Id: I7e04fe36929cc634ddf0078db96fbc40afb38f8c
Signed-off-by: default avatarCunyin Chang <cunyin.chang@intel.com>
parent 919c4b54
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -346,16 +346,14 @@ nvme_ctrlr_set_supported_features(struct spdk_nvme_ctrlr *ctrlr)
void
nvme_ctrlr_fail(struct spdk_nvme_ctrlr *ctrlr, bool hot_remove)
{
	struct spdk_nvme_qpair *qpair;

	/*
	 * Set the flag here and leave the work failure of qpairs to
	 * spdk_nvme_qpair_process_completions().
	 */
	if (hot_remove) {
		ctrlr->is_removed = true;
	}
	ctrlr->is_failed = true;
	nvme_qpair_fail(ctrlr->adminq);
	TAILQ_FOREACH(qpair, &ctrlr->active_io_qpairs, tailq) {
		nvme_qpair_fail(qpair);
	}
}

static void
+5 −0
Original line number Diff line number Diff line
@@ -1866,6 +1866,11 @@ nvme_pcie_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_
	uint32_t		 num_completions = 0;
	struct spdk_nvme_ctrlr	*ctrlr = qpair->ctrlr;

	if (qpair->ctrlr->is_failed) {
		nvme_qpair_fail(qpair);
		return 0;
	}

	if (!nvme_pcie_qpair_check_enabled(qpair)) {
		/*
		 * qpair is not enabled, likely because a controller reset is
+5 −0
Original line number Diff line number Diff line
@@ -65,6 +65,11 @@ struct io_request {
	bool	invalid_second_addr;
};

void
nvme_qpair_fail(struct spdk_nvme_qpair *qpair)
{
}

void
nvme_ctrlr_fail(struct spdk_nvme_ctrlr *ctrlr, bool hot_remove)
{