]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virQEMUCapsInitQMP: Don't dispose locked @vm
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 10 Mar 2015 13:23:43 +0000 (14:23 +0100)
committerCole Robinson <crobinso@redhat.com>
Tue, 28 Apr 2015 15:06:39 +0000 (11:06 -0400)
When creating qemu capabilities, a dummy virDomainObj is created just
because our monitor code expects that. However, the object is created
locked already. Then, under cleanup label, we simply unref the object
which results in whole domain object to be disposed. The object lock
is destroyed subsequently, but hey - it's still locked:

==24845== Thread #14's call to pthread_mutex_destroy failed
==24845==    with error code 16 (EBUSY: Device or resource busy)
==24845==    at 0x4C3024E: pthread_mutex_destroy (in /usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
==24845==    by 0x531F72E: virMutexDestroy (virthread.c:83)
==24845==    by 0x5302977: virObjectLockableDispose (virobject.c:237)
==24845==    by 0x5302A89: virObjectUnref (virobject.c:265)
==24845==    by 0x1DD37866: virQEMUCapsInitQMP (qemu_capabilities.c:3397)
==24845==    by 0x1DD37CC6: virQEMUCapsNewForBinary (qemu_capabilities.c:3481)
==24845==    by 0x1DD381E2: virQEMUCapsCacheLookup (qemu_capabilities.c:3609)
==24845==    by 0x1DD30F8A: virQEMUCapsInitGuest (qemu_capabilities.c:744)
==24845==    by 0x1DD31889: virQEMUCapsInit (qemu_capabilities.c:1020)
==24845==    by 0x1DD7DD36: virQEMUDriverCreateCapabilities (qemu_conf.c:888)
==24845==    by 0x1DDC57C0: qemuStateInitialize (qemu_driver.c:803)
==24845==    by 0x53DC743: virStateInitialize (libvirt.c:777)
==24845==

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 954427c35477752a4ef1789035f298fc9e7287e9)

src/qemu/qemu_capabilities.c

index 8193805b00b247fdb7641a64a9986ec01aa2b8ea..c513d46e10551df09eaf2bc4b9e11540321355e2 100644 (file)
@@ -41,6 +41,7 @@
 #include "qemu_monitor.h"
 #include "virstring.h"
 #include "qemu_hostdev.h"
+#include "qemu_domain.h"
 
 #include <fcntl.h>
 #include <sys/stat.h>
@@ -3394,7 +3395,7 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
     if (monpath)
         ignore_value(unlink(monpath));
     VIR_FREE(monpath);
-    virObjectUnref(vm);
+    qemuDomObjEndAPI(&vm);
     virObjectUnref(xmlopt);
 
     if (pid != 0) {