[libvirt] [PATCH 03/32] node_device_udev: initialize libpciaccess after the driver lock

Ján Tomko jtomko at redhat.com
Mon Jun 6 09:01:40 UTC 2016


This will simplify cleanup.
---
 src/node_device/node_device_udev.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index ebf5145..ef8d7af 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1517,11 +1517,12 @@ static int nodeStateCleanup(void)
         virMutexDestroy(&driver->lock);
         VIR_FREE(driver);
         VIR_FREE(priv);
+
+        udevPCITranslateDeinit();
     } else {
         ret = -1;
     }
 
-    udevPCITranslateDeinit();
     return ret;
 }
 
@@ -1711,9 +1712,6 @@ static int nodeStateInitialize(bool privileged,
     struct udev *udev = NULL;
     int ret = -1;
 
-    if (udevPCITranslateInit(privileged) < 0)
-        goto out;
-
     if (VIR_ALLOC(priv) < 0)
         goto out;
 
@@ -1734,6 +1732,11 @@ static int nodeStateInitialize(bool privileged,
 
     nodeDeviceLock();
 
+    if (udevPCITranslateInit(privileged) < 0) {
+        VIR_FREE(priv);
+        goto out_unlock;
+    }
+
     /*
      * http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/libudev-udev.html#udev-new
      *
-- 
2.7.3




More information about the libvir-list mailing list