]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-topology: fix controller check in scan_subsystem()
authorMartin George <marting@netapp.com>
Mon, 19 Jul 2021 17:07:48 +0000 (10:07 -0700)
committerKeith Busch <kbusch@kernel.org>
Mon, 19 Jul 2021 17:10:38 +0000 (10:10 -0700)
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

index 6d2edaaec8e653f16333e3c7efa8ae1ba7dacc92..7a6baa0c859885f36d78b8ca83d83ad7df84149f 100644 (file)
@@ -384,7 +384,9 @@ static int scan_subsystem(struct nvme_subsystem *s, __u32 ns_instance, int nsid)
                        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;
                        }
                }