Skip to content

Commit fbd6a42

Browse files
hreineckeChristoph Hellwig
authored andcommitted
nvme-multipath: do not fall back to __nvme_find_path() for non-optimized paths
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. Fixes: 75c10e7 ("nvme-multipath: round-robin I/O policy") Signed-off-by: Martin Wilck <mwilck@suse.com> Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 3f6e324 commit fbd6a42

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/nvme/host/multipath.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,13 @@ inline struct nvme_ns *nvme_find_path(struct nvme_ns_head *head)
281281
struct nvme_ns *ns;
282282

283283
ns = srcu_dereference(head->current_path[node], &head->srcu);
284-
if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR && ns)
285-
ns = nvme_round_robin_path(head, node, ns);
286-
if (unlikely(!ns || !nvme_path_is_optimized(ns)))
287-
ns = __nvme_find_path(head, node);
284+
if (unlikely(!ns))
285+
return __nvme_find_path(head, node);
286+
287+
if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR)
288+
return nvme_round_robin_path(head, node, ns);
289+
if (unlikely(!nvme_path_is_optimized(ns)))
290+
return __nvme_find_path(head, node);
288291
return ns;
289292
}
290293

0 commit comments

Comments
 (0)