[PATCH 3/4] nvme: unfreeze queues before removing namespaces
Ming Lei
ming.lei at redhat.com
Thu Jun 15 07:32:35 PDT 2023
If removal is from breaking error recovery, queues may be frozen, and
there may be pending IOs in bio_queue_enter(), and the following
del_gendisk() may wait for these IOs, especially from writeback.
Similar IO hang exists in flushing scan work too if there are pending
IO in scan work context.
Fix the kind of issue by unfreezing queues before removing namespace,
so that all pending IOs can be handled.
Reported-by: Chunguang Xu <brookxu.cn at gmail.com>
https://lore.kernel.org/linux-nvme/cover.1685350577.git.chunguang.xu@shopee.com/
Reported-by: Yi Zhang <yi.zhang at redhat.com>
Signed-off-by: Ming Lei <ming.lei at redhat.com>
---
drivers/nvme/host/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 96785913845b..ec7bd33b7e5f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4645,6 +4645,9 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl)
*/
nvme_mpath_clear_ctrl_paths(ctrl);
+ /* unfreeze queues which may be frozen from error recovery */
+ nvme_unfreeze_force(ctrl);
+
/* prevent racing with ns scanning */
flush_work(&ctrl->scan_work);
--
2.40.1
More information about the Linux-nvme
mailing list