aboutsummaryrefslogtreecommitdiff
path: root/src/libxl
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2012-05-21 12:10:53 +0100
committerDaniel P. Berrange <berrange@redhat.com>2012-05-21 18:50:47 +0100
commit2cb0899eec72376629a0583647dcad39b00c5715 (patch)
treedca424a71e0f309e827041652fd236145926a537 /src/libxl
parentFix build when configuring with polkit0 (diff)
downloadlibvirt-2cb0899eec72376629a0583647dcad39b00c5715.tar.gz
libvirt-2cb0899eec72376629a0583647dcad39b00c5715.tar.bz2
libvirt-2cb0899eec72376629a0583647dcad39b00c5715.zip
Fix potential events deadlock when unref'ing virConnectPtr
When the last reference to a virConnectPtr is released by libvirtd, it was possible for a deadlock to occur in the virDomainEventState functions. The virDomainEventStatePtr holds a reference on virConnectPtr for each registered callback. When removing a callback, the virUnrefConnect function is run. If this causes the last reference on the virConnectPtr to be released, then virReleaseConnect can be run, which in turns calls qemudClose. This function has a call to virDomainEventStateDeregisterConn which is intended to remove all callbacks associated with the virConnectPtr instance. This will try to grab a lock on virDomainEventState but this lock is already held. Deadlock ensues Thread 1 (Thread 0x7fcbb526a840 (LWP 23185)): Since each callback associated with a virConnectPtr holds a reference on virConnectPtr, it is impossible for the qemudClose method to be invoked while any callbacks are still registered. Thus the call to virDomainEventStateDeregisterConn must in fact be a no-op. Thus it is possible to just remove all trace of virDomainEventStateDeregisterConn and avoid the deadlock. * src/conf/domain_event.c, src/conf/domain_event.h, src/libvirt_private.syms: Delete virDomainEventStateDeregisterConn * src/libxl/libxl_driver.c, src/lxc/lxc_driver.c, src/qemu/qemu_driver.c, src/uml/uml_driver.c: Remove calls to virDomainEventStateDeregisterConn
Diffstat (limited to 'src/libxl')
-rw-r--r--src/libxl/libxl_driver.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 45bf1f84c..fc90d1650 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1081,10 +1081,6 @@ libxlClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{
libxlDriverPrivatePtr driver = conn->privateData;
- libxlDriverLock(driver);
- virDomainEventStateDeregisterConn(conn,
- driver->domainEventState);
- libxlDriverUnlock(driver);
conn->privateData = NULL;
return 0;
}