Commit 9407fd14 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Greg Kroah-Hartman
Browse files

nvme: flush namespace scanning work just before removing namespaces

[ Upstream commit f6c8e432


nvme_stop_ctrl can be called also for reset flow and there is no need to
flush the scan_work as namespaces are not being removed. This can cause
deadlock in rdma, fc and loop drivers since nvme_stop_ctrl barriers
before controller teardown (and specifically I/O cancellation of the
scan_work itself) takes place, but the scan_work will be blocked anyways
so there is no need to flush it.

Instead, move scan_work flush to nvme_remove_namespaces() where it really
needs to flush.
Reported-by: default avatarMing Lei <>
Signed-off-by: default avatarSagi Grimberg <>
Reviewed-by: default avatarKeith Busch <>
Reviewed by: James Smart <>
Tested-by: default avatarEwan D. Milne <>
Signed-off-by: default avatarChristoph Hellwig <>
Signed-off-by: default avatarSasha Levin <>
parent 0859bb25
......@@ -2572,6 +2572,9 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl)
struct nvme_ns *ns, *next;
/* prevent racing with ns scanning */
* The dead states indicates the controller was not gracefully
* disconnected. In that case, we won't be able to flush any data while
......@@ -2743,7 +2746,6 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment