Blame nvme_scan_ctrl_1.patch
|
Tomas Bzatek |
4a3e65 |
commit df80eb6a6357bbaa05dcad3503918745323ad8f1
|
|
Tomas Bzatek |
4a3e65 |
Author: Tomas Bzatek <tbzatek@redhat.com>
|
|
Tomas Bzatek |
4a3e65 |
Date: Tue Mar 22 16:22:30 2022 +0100
|
|
Tomas Bzatek |
4a3e65 |
|
|
Tomas Bzatek |
4a3e65 |
tree: Fix subsystem initialization in nvme_scan_ctrl()
|
|
Tomas Bzatek |
4a3e65 |
|
|
Tomas Bzatek |
4a3e65 |
The subsystem instance would normally get properly initialized
|
|
Tomas Bzatek |
4a3e65 |
in later stages of topology scanning, unless there's a host
|
|
Tomas Bzatek |
4a3e65 |
mismatch and the instance would stand alone.
|
|
Tomas Bzatek |
4a3e65 |
|
|
Tomas Bzatek |
4a3e65 |
diff --git a/src/nvme/tree.c b/src/nvme/tree.c
|
|
Tomas Bzatek |
4a3e65 |
index 96106b0..0764690 100644
|
|
Tomas Bzatek |
4a3e65 |
--- a/src/nvme/tree.c
|
|
Tomas Bzatek |
4a3e65 |
+++ b/src/nvme/tree.c
|
|
Tomas Bzatek |
4a3e65 |
@@ -1364,10 +1364,13 @@ nvme_ctrl_t nvme_scan_ctrl(nvme_root_t r, const char *name)
|
|
Tomas Bzatek |
4a3e65 |
subsysname = nvme_ctrl_lookup_subsystem_name(r, name);
|
|
Tomas Bzatek |
4a3e65 |
/* subsysname might be NULL here */
|
|
Tomas Bzatek |
4a3e65 |
s = nvme_lookup_subsystem(h, subsysname, subsysnqn);
|
|
Tomas Bzatek |
4a3e65 |
- if (subsysname)
|
|
Tomas Bzatek |
4a3e65 |
- free(subsysname);
|
|
Tomas Bzatek |
4a3e65 |
free(subsysnqn);
|
|
Tomas Bzatek |
4a3e65 |
- if (!s) {
|
|
Tomas Bzatek |
4a3e65 |
+
|
|
Tomas Bzatek |
4a3e65 |
+ ret = 0;
|
|
Tomas Bzatek |
4a3e65 |
+ if (s && !s->name)
|
|
Tomas Bzatek |
4a3e65 |
+ ret = nvme_init_subsystem(s, subsysname);
|
|
Tomas Bzatek |
4a3e65 |
+ free(subsysname);
|
|
Tomas Bzatek |
4a3e65 |
+ if (!s || ret < 0) {
|
|
Tomas Bzatek |
4a3e65 |
free(path);
|
|
Tomas Bzatek |
4a3e65 |
errno = ENOMEM;
|
|
Tomas Bzatek |
4a3e65 |
return NULL;
|