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: JinYu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449316
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
JinYu 2019-03-28 03:00:24 +08:00 committed by Changpeng Liu
parent f8815f02af
commit 5874e2ac6c

View File

@ -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;
}