Skip to content

Commit 041bd1a

Browse files
igawChristoph Hellwig
authored andcommitted
nvme: only call synchronize_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. Signed-off-by: Daniel Wagner <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent b58da2d commit 041bd1a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/nvme/host/core.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3838,9 +3838,12 @@ static void nvme_ns_remove(struct nvme_ns *ns)
38383838
list_del_rcu(&ns->siblings);
38393839
mutex_unlock(&ns->ctrl->subsys->lock);
38403840

3841-
synchronize_rcu(); /* guarantee not available in head->list */
3842-
nvme_mpath_clear_current_path(ns);
3843-
synchronize_srcu(&ns->head->srcu); /* wait for concurrent submissions */
3841+
/* guarantee not available in head->list */
3842+
synchronize_rcu();
3843+
3844+
/* wait for concurrent submissions */
3845+
if (nvme_mpath_clear_current_path(ns))
3846+
synchronize_srcu(&ns->head->srcu);
38443847

38453848
if (!nvme_ns_head_multipath(ns->head))
38463849
nvme_cdev_del(&ns->cdev, &ns->cdev_device);

0 commit comments

Comments
 (0)