Commit 5874e2ac authored by JinYu's avatar JinYu Committed by Changpeng Liu
Browse files

nvme:complete I/O and abort rest I/O before destroy io_qpair



Logically we should complete any I/O in the completion queue and
abort the rest of the I/O after we delete the submission queue
and completion queue, so that we would not lost any complete I/O.
We alse should complete I/O and abort I/O before destroy I/O qpair
even though the ctrlr/device has been removed.

Change-Id: Ieb28ad7b4a3a7be553f70178b29ca870b5413191
Signed-off-by: default avatarJinYu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449316


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent f8815f02
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -1692,14 +1692,6 @@ nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_
		return -1;
	}

	if (qpair->no_deletion_notification_needed == 0) {
		/* Complete any I/O in the completion queue */
		nvme_pcie_qpair_process_completions(qpair, 0);

		/* Abort the rest of the I/O */
		nvme_pcie_qpair_abort_trackers(qpair, 1);
	}

	/* Delete the completion queue */
	rc = nvme_pcie_ctrlr_cmd_delete_io_cq(ctrlr, qpair, nvme_completion_poll_cb, &status);
	if (rc != 0) {
@@ -1711,6 +1703,14 @@ nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_
	}

free:
	if (qpair->no_deletion_notification_needed == 0) {
		/* Complete any I/O in the completion queue */
		nvme_pcie_qpair_process_completions(qpair, 0);

		/* Abort the rest of the I/O */
		nvme_pcie_qpair_abort_trackers(qpair, 1);
	}

	nvme_pcie_qpair_destroy(qpair);
	return 0;
}