[libvirt] [PATCH 4/8] virHostdevReAttachPCIDevices: Construct pcidevs list earlier

Michal Privoznik posted 8 patches 6 years, 7 months ago
[libvirt] [PATCH 4/8] virHostdevReAttachPCIDevices: Construct pcidevs list earlier
Posted by Michal Privoznik 6 years, 7 months ago
There's no need to translate virDomainHostdevDef-s into
virPCIDevice-s with locked list of PCI devices.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/util/virhostdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 7b5ccf2daf..79a6ec86fe 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -963,16 +963,16 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
     if (!nhostdevs)
         return;
 
-    virObjectLock(mgr->activePCIHostdevs);
-    virObjectLock(mgr->inactivePCIHostdevs);
-
     if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))) {
         VIR_ERROR(_("Failed to allocate PCI device list: %s"),
                   virGetLastErrorMessage());
         virResetLastError();
-        goto cleanup;
+        return;
     }
 
+    virObjectLock(mgr->activePCIHostdevs);
+    virObjectLock(mgr->inactivePCIHostdevs);
+
     /* Reattaching devices to the host involves several steps; each
      * of them is described at length below */
 
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 4/8] virHostdevReAttachPCIDevices: Construct pcidevs list earlier
Posted by Ján Tomko 6 years, 7 months ago
On Tue, Jun 18, 2019 at 03:04:23PM +0200, Michal Privoznik wrote:
>There's no need to translate virDomainHostdevDef-s into
>virPCIDevice-s with locked list of PCI devices.
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/util/virhostdev.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>

util/virhostdev.c:1091:2: error: unused label 'cleanup' [-Werror,-Wunused-label]
 cleanup:
 ^~~~~~~~

with that fixed:
Reviewed-by: Ján Tomko <jtomko@redhat.com>

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