Skip to contentSkip to conversation

hw/block/nvme: fix legacy namespace registration

PATCH In review Klaus Jensen 3 participants 3 messages Feb 11, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/block/nvme: fix legacy namespace registration

From: Klaus Jensen <[email protected]>

Moving namespace registration to the nvme-ns realization function had the unintended side-effect of breaking legacy namespace registration. Fix this.

Fixes 15d024d4aa9b ("hw/block/nvme: split setup and register for namespace")
Cc Minwoo Im <[email protected]>
---
 hw/block/nvme.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/block/nvme.c +6 -0
index 5ce21b7100b3..d36e14fe13e2 100644
@@ -4507,6 +4507,12 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
         if (nvme_ns_setup(ns, errp)) {
             return;
         }
+
+        if (nvme_register_namespace(n, ns, errp)) {
+            error_propagate_prepend(errp, local_err,
+                                    "could not register namespace: ");
+            return;
+        }
     }
 }
 
Signature · 1 line
2.30.0
Tested-by on v1 1/1
#1 lore raw
Quoted 10 lines · Klaus Jensen

From: Klaus Jensen <[email protected]>

Moving namespace registration to the nvme-ns realization function had the unintended side-effect of breaking legacy namespace registration. Fix this.

Fixes 15d024d4aa9b ("hw/block/nvme: split setup and register for namespace")
Cc Minwoo Im <[email protected]>

I can confirm that this fixes the upstream regression. Thanks a lot. Please work on a way with Peter to pull this into the tree as quickly as possible, so that we maintain a working master branch with NVMe.

Thanks!

Alex

Quoted 21 lines
---
  hw/block/nvme.c | 6 ++++++
  1 file changed, 6 insertions(+)
hw/block/nvme.c +6 -0
index 5ce21b7100b3..d36e14fe13e2 100644
@@ -4507,6 +4507,12 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
          if (nvme_ns_setup(ns, errp)) {
              return;
          }
+
+        if (nvme_register_namespace(n, ns, errp)) {
+            error_propagate_prepend(errp, local_err,
+                                    "could not register namespace: ");
+            return;
+        }
      }
  }