[PATCH 3/8] virHostdevPreparePCIDevices: Construct pcidevs list earlier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There's no need to translate virDomainHostdevDef-s into
virPCIDevice-s with locked list of PCI devices.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/util/virhostdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 5935d926aa..7b5ccf2daf 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -639,11 +639,11 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
     if (!nhostdevs)
         return 0;
 
-    virObjectLock(mgr->activePCIHostdevs);
-    virObjectLock(mgr->inactivePCIHostdevs);
-
     if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs)))
-        goto cleanup;
+        return -1;
+
+    virObjectLock(mgr->activePCIHostdevs);
+    virObjectLock(mgr->inactivePCIHostdevs);
 
     /* Detaching devices from the host involves several steps; each
      * of them is described at length below.
@@ -912,9 +912,9 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
     }
 
  cleanup:
-    virObjectUnref(pcidevs);
     virObjectUnlock(mgr->activePCIHostdevs);
     virObjectUnlock(mgr->inactivePCIHostdevs);
+    virObjectUnref(pcidevs);
 
     return ret;
 }
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux