libvirt/src/qemu
Peter Krempa 3d3de46a67 qemu: Fix deadlock when qemuDomainOpenConsole cleans up a connection
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.

Backtrace of the deadlocked thread:
0  0x00007f66e5aa7f14 in __lll_lock_wait () from /lib64/libpthread.so.0
1  0x00007f66e5aa3411 in _L_lock_500 () from /lib64/libpthread.so.0
2  0x00007f66e5aa322a in pthread_mutex_lock () from/lib64/libpthread.so.0
3  0x0000000000462bbd in qemudClose ()
4  0x00007f66e6e178eb in virReleaseConnect () from/usr/lib64/libvirt.so.0
5  0x00007f66e6e19c8c in virUnrefStream () from /usr/lib64/libvirt.so.0
6  0x00007f66e6e3d1de in virStreamFree () from /usr/lib64/libvirt.so.0
7  0x00007f66e6e09a5d in virConsoleHashEntryFree () from/usr/lib64/libvirt.so.0
8  0x00007f66e6db7282 in virHashRemoveEntry () from/usr/lib64/libvirt.so.0
9  0x00007f66e6e09c4e in virConsoleOpen () from /usr/lib64/libvirt.so.0
10 0x00000000004526e9 in qemuDomainOpenConsole ()
11 0x00007f66e6e421f1 in virDomainOpenConsole () from/usr/lib64/libvirt.so.0
12 0x00000000004361e4 in remoteDispatchDomainOpenConsoleHelper ()
13 0x00007f66e6e80375 in virNetServerProgramDispatch () from/usr/lib64/libvirt.so.0
14 0x00007f66e6e7ae11 in virNetServerHandleJob () from/usr/lib64/libvirt.so.0
15 0x00007f66e6da897d in virThreadPoolWorker () from/usr/lib64/libvirt.so.0
16 0x00007f66e6da7ff6 in virThreadHelper () from/usr/lib64/libvirt.so.0
17 0x00007f66e5aa0c5c in start_thread () from /lib64/libpthread.so.0
18 0x00007f66e57e7fcd in clone () from /lib64/libc.so.6

* src/qemu/qemu_driver.c: qemuDomainOpenConsole()
        -- unlock the qemu driver right after acquiring the domain
        object
2012-04-11 10:45:53 +02:00
..
libvirtd_qemu.aug Add two new security label types 2012-02-02 17:44:37 -07:00
MIGRATION.txt qemu: Implement migration job phases 2011-07-27 08:45:09 -06:00
qemu_agent.c qemu_agent: Issue guest-sync prior to every command 2012-03-30 18:16:17 +02:00
qemu_agent.h qemu: Implement DomainPMSuspendForDuration 2012-02-15 11:45:45 +01:00
qemu_bridge_filter.c
qemu_bridge_filter.h
qemu_capabilities.c snapshot: add qemu capability for 'transaction' command 2012-03-23 16:38:19 -06:00
qemu_capabilities.h snapshot: add qemu capability for 'transaction' command 2012-03-23 16:38:19 -06:00
qemu_cgroup.c qemu: eliminate "Ignoring open failure" when using root-squash NFS 2012-02-03 16:47:43 -05:00
qemu_cgroup.h qemu: Implement period and quota tunable XML configuration and parsing 2011-07-21 17:11:12 +08:00
qemu_command.c Wire up <loader> to set the QEMU BIOS path 2012-04-10 16:34:39 +01:00
qemu_command.h build: use correct type for pid and similar types 2012-03-02 06:57:43 -07:00
qemu_conf.c qemu: Add connection close callbacks 2012-03-21 17:31:09 +01:00
qemu_conf.h qemu: Make autodestroy utilize connection close callbacks 2012-03-21 17:31:09 +01:00
qemu_domain.c qemu: Warn on possibly incorrect usage of EnterMonitor* 2012-04-11 09:57:39 +02:00
qemu_domain.h qemu: Track job owner for better debugging 2012-04-11 09:57:39 +02:00
qemu_driver.c qemu: Fix deadlock when qemuDomainOpenConsole cleans up a connection 2012-04-11 10:45:53 +02:00
qemu_driver.h Split all QEMU process mangement code into separate file 2011-02-17 12:48:55 +00:00
qemu_hostdev.c qemu: Build activeUsbHostdevs list on process reconnect 2012-04-04 15:09:41 +02:00
qemu_hostdev.h qemu: Build activeUsbHostdevs list on process reconnect 2012-04-04 15:09:41 +02:00
qemu_hotplug.c qemu: Start nested job in qemuDomainCheckEjectableMedia 2012-04-02 21:44:27 +02:00
qemu_hotplug.h qemu: Start nested job in qemuDomainCheckEjectableMedia 2012-04-02 21:44:27 +02:00
qemu_migration.c qemu: Track job owner for better debugging 2012-04-11 09:57:39 +02:00
qemu_migration.h qemu: Avoid dangling migration-out job when client dies 2012-03-21 17:31:09 +01:00
qemu_monitor_json.c snapshot: fix memory leak on error 2012-04-06 08:39:34 -06:00
qemu_monitor_json.h snapshot: improve qemu handling of reused snapshot targets 2012-03-23 16:38:20 -06:00
qemu_monitor_text.c Consistent style for usage of sizeof operator 2012-03-30 11:47:24 +01:00
qemu_monitor_text.h xml: use better types for memory values 2012-03-07 18:24:44 -07:00
qemu_monitor.c snapshot: improve qemu handling of reused snapshot targets 2012-03-23 16:38:20 -06:00
qemu_monitor.h snapshot: improve qemu handling of reused snapshot targets 2012-03-23 16:38:20 -06:00
qemu_process.c qemu: Track job owner for better debugging 2012-04-11 09:57:39 +02:00
qemu_process.h fix a deadlock when qemu cannot start 2012-03-30 14:21:49 +08:00
qemu.conf qemu driver for virDomainGetCPUstats using cpuacct cgroup. 2012-03-06 21:54:48 -07:00
test_libvirtd_qemu.aug qemu: Support for overriding NOFILE limit 2011-12-22 17:49:04 +01:00
THREADS.txt qemu: fix crash when mixing sync and async monitor jobs 2011-08-01 09:41:57 -06:00