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

Re: [libvirt] [PATCH] Fix potential events deadlock when unref'ing virConnectPtr



On 05/21/2012 05:17 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> 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.
> 
> 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
> ---
>  src/conf/domain_event.c  |   61 ----------------------------------------------
>  src/conf/domain_event.h  |    4 ---
>  src/libvirt_private.syms |    1 -
>  src/libxl/libxl_driver.c |    4 ---
>  src/lxc/lxc_driver.c     |    2 --
>  src/qemu/qemu_driver.c   |    2 --
>  src/uml/uml_driver.c     |    2 --
>  7 files changed, 76 deletions(-)

Always fun to fix bugs by deletion.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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