|
@@ -95,6 +95,15 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
+ case NVME_CTRL_DEAD:
|
|
|
+ switch (old_state) {
|
|
|
+ case NVME_CTRL_DELETING:
|
|
|
+ changed = true;
|
|
|
+ /* FALLTHRU */
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -1595,6 +1604,15 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl)
|
|
|
{
|
|
|
struct nvme_ns *ns, *next;
|
|
|
|
|
|
+ /*
|
|
|
+ * The dead states indicates the controller was not gracefully
|
|
|
+ * disconnected. In that case, we won't be able to flush any data while
|
|
|
+ * removing the namespaces' disks; fail all the queues now to avoid
|
|
|
+ * potentially having to clean up the failed sync later.
|
|
|
+ */
|
|
|
+ if (ctrl->state == NVME_CTRL_DEAD)
|
|
|
+ nvme_kill_queues(ctrl);
|
|
|
+
|
|
|
mutex_lock(&ctrl->namespaces_mutex);
|
|
|
list_for_each_entry_safe(ns, next, &ctrl->namespaces, list)
|
|
|
nvme_ns_remove(ns);
|