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

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