]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Fix deadlock in QEMU close callback APIs
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 28 Feb 2013 13:30:49 +0000 (13:30 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 1 Mar 2013 10:16:29 +0000 (10:16 +0000)
commit96b893f092b3972bc04be975945830dc974af2b3
treefa7a2f17c04374b0b72dd89f3ffc8b8d9b5cf04b
parent7ccad0b16d12d7616c7c21b1359f6a55a9677521
Fix deadlock in QEMU close callback APIs

There is a lock ordering problem in the QEMU close callback
APIs.

When starting a guest we have a lock on the VM. We then
set a autodestroy callback, which acquires a lock on the
close callbacks.

When running auto-destroy, we obtain a lock on the close
callbacks, then run each callbacks - which obtains a lock
on the VM.

This causes deadlock if anyone tries to start a VM, while
autodestroy is taking place.

The fix is to do autodestroy in 2 phases. First obtain
all the callbacks and remove them from the list under
the close callback lock. Then invoke each callback
from outside the close callback lock.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/qemu/qemu_conf.c