Skip to content

Rework nvme_scan_subsystem()#324

Merged
hreinecke merged 3 commits intolinux-nvme:masterfrom
hreinecke:subsystem-rework
Mar 31, 2022
Merged

Rework nvme_scan_subsystem()#324
hreinecke merged 3 commits intolinux-nvme:masterfrom
hreinecke:subsystem-rework

Conversation

@hreinecke
Copy link
Copy Markdown
Collaborator

When scanning the subsystem in sysfs we cannot infer the corresponding host that easily, so rework the logic to not allocate the subsystem with the wrong host.

Comment thread src/nvme/tree.c Outdated
We're always calling nvme_init_subsystem() when nvme_lookup_subsystem()
is called with a non-NULL 'name' parameter. So we might as well move
it into nvme_lookup_subsystem() and simplify the callers.

Signed-off-by: Hannes Reinecke <hare@suse.de>
nvme_scan_ctrl() is iterating over sysfs, so any controller must
have a corresponding subsystem; not finding one is an error.

Signed-off-by: Hannes Reinecke <hare@suse.de>
The nvme subsystem does not have a 'hostnqn' sysfs entry, so we
cannot infer from the nvme subsystem sysfs entry to which host
it relates. And really, the subsystem should already have been
created by the previous call to nvme_scan_ctrl().
So do not call nvme_lookup_subsystem() in nvme_scan_subystem(),
but rather just validate the sysfs subsystem entries and create
any missing subsystems.

Signed-off-by: Hannes Reinecke <hare@suse.de>
@hreinecke hreinecke merged commit 0d1f8a1 into linux-nvme:master Mar 31, 2022
@hreinecke hreinecke deleted the subsystem-rework branch March 31, 2022 07:40
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.

4 participants