diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -1078,12 +1078,10 @@ if (qpair->ctrlr->is_failed) { /* - * The controller has failed. Post the request to a - * task where it will be aborted, so that we do not - * invoke the request's callback in the context - * of the submission. + * The controller has failed, so fail the request. */ - nvme_ctrlr_post_failed_request(qpair->ctrlr, req); + nvme_qpair_manual_complete_request(qpair, req, + NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST); } else { /* * Put the request on the qpair's request queue to be diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c --- a/sys/dev/nvme/nvme_sim.c +++ b/sys/dev/nvme/nvme_sim.c @@ -258,6 +258,10 @@ break; case XPT_NVME_IO: /* Execute the requested I/O operation */ case XPT_NVME_ADMIN: /* or Admin operation */ + if (ctrlr->is_failed) { + ccb->ccb_h.status = CAM_DEV_NOT_THERE; + break; + } nvme_sim_nvmeio(sim, ccb); return; /* no done */ default: