Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvme-print-stdout: List only ctrls which are part of ns #2008

Merged
merged 1 commit into from
Jul 24, 2023

Conversation

igaw
Copy link
Collaborator

@igaw igaw commented Jul 21, 2023

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: a660c50 ("nvme-print-stdout: Support subsys reachable from several hosts")

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: a660c50 ("nvme-print-stdout: Support subsys reachable from several hosts")
Signed-off-by: Daniel Wagner <[email protected]>
@@ -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) {
Copy link
Contributor

@ikegami-t ikegami-t Jul 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but to make sure let me confirm if is this worked for not multipath case also since the function nvme_namespace_for_each_path() is used to check multipath as below? (Seems for the not multipath case no controller listed if the function implementation correct.)

static bool nvme_is_multipath(nvme_subsystem_t s)
{
...
	nvme_subsystem_for_each_ns(s, n)
		nvme_namespace_for_each_path(n, p)
			return true;
...
	return false;
}

Copy link
Collaborator Author

@igaw igaw Jul 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case of !multipath, nvme_ns_get_ctrl(n)) will return a valid pointer right above (ca. line 4691) and then we exit early the function.

This is due the fact !mutlipath devices and multipath devices have two different sysfs hierarchies.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what's worth, I've tested this for both scenarios

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your explanations and confirmation. I could understand them.

@igaw igaw merged commit 04f6ab2 into linux-nvme:master Jul 24, 2023
11 checks passed
@igaw igaw deleted the fix-stdout-detailed-ns branch July 24, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants