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

NAS-128368 / None / nvme: acquire a new subsystem if no valid controllers assigned #178

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2719,8 +2719,21 @@ static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsysnqn)
return NULL;

list_for_each_entry(subsys, &nvme_subsystems, entry) {
bool valid_ctrl = false;
struct nvme_ctrl *ctrl;

if (strcmp(subsys->subnqn, subsysnqn))
continue;
if (list_empty(&subsys->ctrls))
continue;
list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) {
if (!nvme_state_terminal(ctrl)) {
valid_ctrl = true;
break;
}
}
if (!valid_ctrl)
continue;
if (!kref_get_unless_zero(&subsys->ref))
continue;
return subsys;
Expand Down
Loading