From 04f6ab202b578058e9cdca2294fb8f8439a77eea Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Fri, 21 Jul 2023 13:43:02 +0200 Subject: [PATCH] nvme-print-stdout: List only ctrls which are part of ns 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 --- nvme-print-stdout.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nvme-print-stdout.c b/nvme-print-stdout.c index ef0dab4e..9158f1b5 100644 --- a/nvme-print-stdout.c +++ b/nvme-print-stdout.c @@ -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; -- 2.49.0