Blame SOURCES/0005-nvme-topology-fix-controller-check-in-scan_subsystem.patch

2776a8
From bace574bbe55739a49e7fada5483b3d3a5ef361c Mon Sep 17 00:00:00 2001
2776a8
From: Martin George <marting@netapp.com>
2776a8
Date: Mon, 19 Jul 2021 10:07:48 -0700
2776a8
Subject: [PATCH] nvme-topology: fix controller check in scan_subsystem()
2776a8
2776a8
Fix the current check in scan_subsystem() so that it iterates
2776a8
through all the available controllers till it gets a 'live'
2776a8
controller for that namespace.
2776a8
2776a8
Link: https://github.com/linux-nvme/nvme-cli/pull/1101
2776a8
Fixes: ce9d818 ("nvme-topology: scan all controllers in scan_subsystem()")
2776a8
Signed-off-by: Martin George <marting@netapp.com>
2776a8
Reviewed-by: Daniel Wagner <dwagner@suse.de>
2776a8
Signed-off-by: Keith Busch <kbusch@kernel.org>
2776a8
---
2776a8
 nvme-topology.c | 4 +++-
2776a8
 1 file changed, 3 insertions(+), 1 deletion(-)
2776a8
2776a8
diff --git a/nvme-topology.c b/nvme-topology.c
2776a8
index 6d2edaa..7a6baa0 100644
2776a8
--- a/nvme-topology.c
2776a8
+++ b/nvme-topology.c
2776a8
@@ -384,7 +384,9 @@ static int scan_subsystem(struct nvme_subsystem *s, __u32 ns_instance, int nsid)
2776a8
 			n->name = strdup(ns[i]->d_name);
2776a8
 			for (j = 0; j < s->nr_ctrls; j++) {
2776a8
 				n->ctrl = &s->ctrls[j];
2776a8
-				if (!scan_namespace(n))
2776a8
+				if (!strcmp(n->ctrl->state, "live") &&
2776a8
+						!scan_namespace(n))
2776a8
+
2776a8
 					break;
2776a8
 			}
2776a8
 		}
2776a8
-- 
2776a8
2.27.0
2776a8