diff options
author | Daniel Wagner <dwagner@suse.de> | 2021-09-01 12:25:24 +0300 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2021-09-06 11:03:11 +0300 |
commit | 041bd1a1fc737cd73b0b8a9f74909191a8acc9fe (patch) | |
tree | d0f1e9048e46c2f5f04232a7e7f8ebe8737a4eb3 /drivers/nvme | |
parent | b58da2d270dbcc67db73f15028774d27c85e16d7 (diff) | |
download | linux-041bd1a1fc737cd73b0b8a9f74909191a8acc9fe.tar.xz |
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 <dwagner@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/host/core.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 1c98a2f590ea..4a3a33f5f11c 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -3838,9 +3838,12 @@ static void nvme_ns_remove(struct nvme_ns *ns) list_del_rcu(&ns->siblings); 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 */ + /* guarantee not available in head->list */ + synchronize_rcu(); + + /* wait for concurrent submissions */ + if (nvme_mpath_clear_current_path(ns)) + synchronize_srcu(&ns->head->srcu); if (!nvme_ns_head_multipath(ns->head)) nvme_cdev_del(&ns->cdev, &ns->cdev_device); |