[PATCH 1/2] nvme-multipath: fix logic for non-optimized paths

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


From: Martin Wilck <mwilck at suse.com>

Handle the special case where we have exactly one optimized path,
which we should keep using in this case.

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

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 66509472fe06..fe8f7f123fac 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -246,6 +246,12 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
 			fallback = ns;
 	}
 
+	/* No optimized path found, re-check the current path */
+	if (!nvme_path_is_disabled(old) &&
+	    old->ana_state == NVME_ANA_OPTIMIZED) {
+		found = old;
+		goto out;
+	}
 	if (!fallback)
 		return NULL;
 	found = fallback;
-- 
2.16.4




More information about the Linux-nvme mailing list