]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print-stdout: List only ctrls which are part of ns
authorDaniel Wagner <dwagner@suse.de>
Fri, 21 Jul 2023 11:43:02 +0000 (13:43 +0200)
committerDaniel Wagner <wagi@monom.org>
Mon, 24 Jul 2023 16:23:41 +0000 (18:23 +0200)
We should only list the controllers which are associated with the
current namespace. Previously we added all controllers of the subsystem
to the list.

Fixes: a660c506906d ("nvme-print-stdout: Support subsys reachable from several hosts")
Signed-off-by: Daniel Wagner <dwagner@suse.de>
nvme-print-stdout.c

index ef0dab4e992d4f1648e664df708e09d19530ccf9..9158f1b5f4d1115c9e51df453beed8e0e49df871 100644 (file)
@@ -4674,6 +4674,7 @@ static bool stdout_detailed_ns(const char *name, void *arg)
        struct htable_ns_iter it;
        struct strset ctrls;
        nvme_ctrl_t c;
+       nvme_path_t p;
        nvme_ns_t n;
        bool first;
 
@@ -4693,8 +4694,10 @@ static bool stdout_detailed_ns(const char *name, void *arg)
                        return true;
                }
 
-               nvme_subsystem_for_each_ctrl(nvme_ns_get_subsystem(n), c)
+               nvme_namespace_for_each_path(n, p) {
+                       c = nvme_path_get_ctrl(p);
                        strset_add(&ctrls, nvme_ctrl_get_name(c));
+               }
        }
 
        first = true;