[PATCH 2/2] nvme-multipath: do not fall back to __nvme_find_path() for non-optimized paths

Hannes Reinecke hare at suse.de
Mon Jul 27 12:08:03 EDT 2020


When nvme_round_robin_path() finds a valid namespace we should be using it;
falling back to __nvme_find_path() for non-optimized paths will cause the
result from nvme_round_robin_path() to be ignored for non-optimized paths.

Signed-off-by: Martin Wilck <mwilck at suse.com>
Signed-off-by: Hannes Reinecke <hare at suse.de>
---
 drivers/nvme/host/multipath.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index fe8f7f123fac..97d3c19b5684 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -272,8 +272,11 @@ inline struct nvme_ns *nvme_find_path(struct nvme_ns_head *head)
 	struct nvme_ns *ns;
 
 	ns = srcu_dereference(head->current_path[node], &head->srcu);
-	if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR && ns)
+	if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR && ns) {
 		ns = nvme_round_robin_path(head, node, ns);
+		if (ns)
+			return ns;
+	}
 	if (unlikely(!ns || !nvme_path_is_optimized(ns)))
 		ns = __nvme_find_path(head, node);
 	return ns;
-- 
2.16.4




More information about the Linux-nvme mailing list