libnvme/nvme_scan_ctrl_1.patch
Tomas Bzatek 4a3e657cbc * Wed Mar 23 2022 Tomas Bzatek <tbzatek@redhat.com> - 1.0~rc7-1
- Upstream v1.0 Release Candidate 7
- Renamed python3-nvme subpackage to python3-libnvme
2022-03-23 15:53:58 +01:00

32 lines
972 B
Diff

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