Skip to contentSkip to conversation

nvme: only call synhronize_srcu when clearing current path

PATCH Applied Daniel Wagner 2 participants 3 messages Sep 1, 2021 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: only call synhronize_srcu when clearing current path

The function nmve_mpath_clear_current_path returns true if the current path has changed. In this case we have to wait for all concurrent submissions to finish. But if we didn't change the current path, there is no point in waiting for another RCU period to finish.

---
 drivers/nvme/host/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +2 -2
index d3d5cc947525..5b3c74fa89bd 100644
@@ -3814,8 +3814,8 @@ static void nvme_ns_remove(struct nvme_ns *ns)
 	mutex_unlock(&ns->ctrl->subsys->lock);
 
 	synchronize_rcu(); /* guarantee not available in head->list */
-	nvme_mpath_clear_current_path(ns);
-	synchronize_srcu(&ns->head->srcu); /* wait for concurrent submissions */
+	if (nvme_mpath_clear_current_path(ns))
+		synchronize_srcu(&ns->head->srcu); /* wait for concurrent submissions */
 
 	if (ns->disk->flags & GENHD_FL_UP) {
 		if (!nvme_ns_head_multipath(ns->head))
Signature · 1 line
2.29.2
#1 lore raw

Thanks,

applied to nvme-5.15 with a cosmetic fixup to keep the lines from overflowing.