2021-09-01 09:28:05

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v1] 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.

Signed-off-by: Daniel Wagner <[email protected]>
---
drivers/nvme/host/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d3d5cc947525..5b3c74fa89bd 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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))
--
2.29.2


2021-09-01 18:56:04

by Daniel Wagner

[permalink] [raw]
Subject: Re: [PATCH v1] nvme: only call synhronize_srcu when clearing current path

On Wed, Sep 01, 2021 at 01:25:15PM +0100, Christoph Hellwig wrote:
> applied to nvme-5.15 with a cosmetic fixup to keep the lines from
> overflowing.

Thanks, forgot to check the length (I guess I should set max line length
back to 80). Looks way better anyway :)

2021-09-01 21:53:23

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH v1] nvme: only call synhronize_srcu when clearing current path

Thanks,

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