File 0019-nvme-topology-fix-controller-check-in-scan_subsystem.patch of Package nvme-cli.20931
From: Martin George <marting@netapp.com>
Date: Mon, 19 Jul 2021 10:07:48 -0700
Subject: nvme-topology: fix controller check in scan_subsystem()
References: bsc#1186719 bsc#1187287
Git-commit: bace574bbe55739a49e7fada5483b3d3a5ef361c
Fix the current check in scan_subsystem() so that it iterates
through all the available controllers till it gets a 'live'
controller for that namespace.
Link: https://github.com/linux-nvme/nvme-cli/pull/1101
Fixes: ce9d818 ("nvme-topology: scan all controllers in scan_subsystem()")
Signed-off-by: Martin George <marting@netapp.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
nvme-topology.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/nvme-topology.c
+++ b/nvme-topology.c
@@ -282,7 +282,8 @@ static int scan_subsystem(struct nvme_su
n->name = strdup(ns[i]->d_name);
for (j = 0; j < s->nr_ctrls; j++) {
n->ctrl = &s->ctrls[j];
- if (!scan_namespace(n))
+ if (!strcmp(n->ctrl->state, "live") &&
+ !scan_namespace(n))
break;
}
}