[libvirt] [PATCH] qemu: Fix deadlock when qemuDomainOpenConsole cleans up a connection

Eric Blake eblake at redhat.com
Tue Apr 10 15:43:26 UTC 2012


On 04/10/2012 07:29 AM, Peter Krempa wrote:
> The new safe console handling introduced a possibility to deadlock the
> qemu driver when a new console connection forcibly disconnects a
> previous console stream that belongs to an already closed connection.
> 
> The virStreamFree function calls subsequently a the virReleaseConnect
> function that tries to lock the driver while discarding the connection,
> but the driver was already locked in qemuDomainOpenConsole.
> 

> 
> * src/qemu/qemu_driver.c: qemuDomainOpenConsole()
>         -- unlock the qemu driver right after acquiring the domain
>         object
> ---
> Found while writing tests for the libvirt-test-API, its 100% reproducible:
> 
> 1: Start a domain with serial console and run "cat" on this console
> 2: download python reproducer: http://files.pipo.sk/console_deadlock.py
> 3: set guest name in the script
> 4: run the reproducer and "virsh console 'guestname' --force" after that
> 5: <deadlocked>
> 
>  src/qemu/qemu_driver.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

ACK; the rest of the function does not refer to driver, so moving the
unlock sooner is safe.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120410/20da0832/attachment-0001.sig>


More information about the libvir-list mailing list