lib/nvme: don't requeue I/O while destroying.
When we destroy a qpair, we need to flush all of the I/O. But some applications will try to resubmit that I/O. We need to not re-queue those I/O while in the context of the destroy call so as to avoid an infinite loop. Signed-off-by: Seth Howell <seth.howell@intel.com> Change-Id: I3e4863a563d461092f6e6b4a893f965f41bf34e3 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1856 Community-CI: Mellanox Build Bot Community-CI: Broadcom CI Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
af2d56ed94
commit
7defb70d3a
@ -533,6 +533,7 @@ spdk_nvme_ctrlr_free_io_qpair(struct spdk_nvme_qpair *qpair)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Do not retry. */
|
/* Do not retry. */
|
||||||
|
nvme_qpair_set_state(qpair, NVME_QPAIR_DESTROYING);
|
||||||
nvme_qpair_abort_reqs(qpair, 1);
|
nvme_qpair_abort_reqs(qpair, 1);
|
||||||
nvme_robust_mutex_lock(&ctrlr->ctrlr_lock);
|
nvme_robust_mutex_lock(&ctrlr->ctrlr_lock);
|
||||||
|
|
||||||
|
@ -362,6 +362,7 @@ enum nvme_qpair_state {
|
|||||||
NVME_QPAIR_CONNECTED,
|
NVME_QPAIR_CONNECTED,
|
||||||
NVME_QPAIR_ENABLING,
|
NVME_QPAIR_ENABLING,
|
||||||
NVME_QPAIR_ENABLED,
|
NVME_QPAIR_ENABLED,
|
||||||
|
NVME_QPAIR_DESTROYING,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct spdk_nvme_qpair {
|
struct spdk_nvme_qpair {
|
||||||
|
@ -726,7 +726,8 @@ nvme_qpair_submit_request(struct spdk_nvme_qpair *qpair, struct nvme_request *re
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* This prevents us from entering an infinite loop when freeing queued I/O in disconnect. */
|
/* This prevents us from entering an infinite loop when freeing queued I/O in disconnect. */
|
||||||
if (spdk_unlikely(nvme_qpair_get_state(qpair) == NVME_QPAIR_DISCONNECTING)) {
|
if (spdk_unlikely(nvme_qpair_get_state(qpair) == NVME_QPAIR_DISCONNECTING ||
|
||||||
|
nvme_qpair_get_state(qpair) == NVME_QPAIR_DESTROYING)) {
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user