
On 03/16/2012 11:53 AM, Jim Fehlig wrote:
Question for other libvirt devs:
Many of the libxl driver functions use this pattern - lock driver - vm = virDomainFindByUUID // acquires dom obj lock - unlock driver - do stuff - virDomainObjUnlock
In some cases, "do stuff" requires obtaining the driver lock (e.g. removing a domain from driver's domain list), in which case there is potential for deadlock. Any suggestions for preventing the deadlock *and* avoiding locking the driver during long running operations?
See src/qemu/THREADS.txt. That gives the details on how to drop the driver lock and even the domain object lock, by maintaining a reference count and job condition on each domain to ensure that others can still use the driver, just not for the domain whose job is still occupied. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org