diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index f1d0911a59..9879b54d52 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -766,7 +766,6 @@ nvme_ctrlr_shutdown(struct spdk_nvme_ctrlr *ctrlr) if (csts.bits.shst == SPDK_NVME_SHST_COMPLETE) { SPDK_DEBUGLOG(SPDK_LOG_NVME, "shutdown complete in %u milliseconds\n", ms_waited); - ctrlr->is_shutdown = true; return; } @@ -1890,8 +1889,8 @@ nvme_ctrlr_async_event_cb(void *arg, const struct spdk_nvme_cpl *cpl) active_proc->aer_cb_fn(active_proc->aer_cb_arg, cpl); } - /* If the ctrlr is already shutdown, we should not send aer again */ - if (ctrlr->is_shutdown) { + /* If the ctrlr was removed or in the destruct state, we should not send aer again */ + if (ctrlr->is_removed || ctrlr->is_destructed) { return; } @@ -2564,7 +2563,7 @@ nvme_ctrlr_construct(struct spdk_nvme_ctrlr *ctrlr) ctrlr->free_io_qids = NULL; ctrlr->is_resetting = false; ctrlr->is_failed = false; - ctrlr->is_shutdown = false; + ctrlr->is_destructed = false; TAILQ_INIT(&ctrlr->active_io_qpairs); STAILQ_INIT(&ctrlr->queued_aborts); @@ -2617,6 +2616,8 @@ nvme_ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr) SPDK_DEBUGLOG(SPDK_LOG_NVME, "Prepare to destruct SSD: %s\n", ctrlr->trid.traddr); + ctrlr->is_destructed = true; + spdk_nvme_qpair_process_completions(ctrlr->adminq, 0); nvme_transport_admin_qpair_abort_aers(ctrlr->adminq); diff --git a/lib/nvme/nvme_internal.h b/lib/nvme/nvme_internal.h index 9f0de3e73a..a4f79e5e55 100644 --- a/lib/nvme/nvme_internal.h +++ b/lib/nvme/nvme_internal.h @@ -638,7 +638,7 @@ struct spdk_nvme_ctrlr { bool is_failed; - bool is_shutdown; + bool is_destructed; bool timeout_enabled;