From 55576d35127c1615419c330f05ba3c3bfc67b9fc Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 10 Mar 2015 14:23:43 +0100 Subject: [PATCH] virQEMUCapsInitQMP: Don't dispose locked @vm 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 (cherry picked from commit 954427c35477752a4ef1789035f298fc9e7287e9) --- src/qemu/qemu_capabilities.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 8193805b00..c513d46e10 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -41,6 +41,7 @@ #include "qemu_monitor.h" #include "virstring.h" #include "qemu_hostdev.h" +#include "qemu_domain.h" #include #include @@ -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) {