libvirt/src
Wen Congyang ac9ee6b5e0 unlock eventLoop before calling callback function
When I use newest libvirt to save a domain, libvirtd will be deadlock.
Here is the output of gdb:
(gdb) thread 3
[Switching to thread 3 (Thread 0x7f972a1fc710 (LWP 30265))]#0  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
(gdb) bt
    at qemu/qemu_driver.c:2074
    ret=0x7f972a1fbbe0) at remote.c:2273
(gdb) thread 7
[Switching to thread 7 (Thread 0x7f9730bcd710 (LWP 30261))]#0  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
(gdb) bt
(gdb) p *(virMutexPtr)0x6fdd60
$2 = {lock = {__data = {__lock = 2, __count = 0, __owner = 30261, __nusers = 1, __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}},
    __size = "\002\000\000\000\000\000\000\000\065v\000\000\001", '\000' <repeats 26 times>, __align = 2}}
(gdb) p *(virMutexPtr)0x1a63ac0
$3 = {lock = {__data = {__lock = 2, __count = 0, __owner = 30265, __nusers = 1, __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}},
    __size = "\002\000\000\000\000\000\000\000\071v\000\000\001", '\000' <repeats 26 times>, __align = 2}}
(gdb) info threads
  7 Thread 0x7f9730bcd710 (LWP 30261)  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
  6 Thread 0x7f972bfff710 (LWP 30262)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  5 Thread 0x7f972b5fe710 (LWP 30263)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  4 Thread 0x7f972abfd710 (LWP 30264)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
* 3 Thread 0x7f972a1fc710 (LWP 30265)  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
  2 Thread 0x7f97297fb710 (LWP 30266)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  1 Thread 0x7f9737aac800 (LWP 30260)  0x000000351fe0803d in pthread_join () from /lib64/libpthread.so.0

The reason is that we will try to lock some object in callback function, and we may call event API with locking the same object.
In the function virEventDispatchHandles(), we unlock eventLoop before calling callback function. I think we should
do the same thing in the function virEventCleanupTimeouts() and virEventCleanupHandles().

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2011-03-07 10:05:17 -07:00
..
conf qemu: Support vram for video of qxl type 2011-03-06 22:00:27 +08:00
cpu hash: make virHashFree more free-like 2011-02-21 08:27:02 -07:00
esx esx: Escape password for XML 2011-03-03 22:18:09 +01:00
interface Implement forgotten backend of virInterfaceIsActive() 2010-04-14 10:38:18 -04:00
lxc Allow hash tables to use generic pointers as keys 2011-02-25 13:00:54 +00:00
network Drop empty argument from dnsmasq call 2011-02-18 22:23:15 +01:00
node_device maint: kill all remaining uses of old DEBUG macro 2011-02-21 08:46:52 -07:00
nwfilter fixes for several memory leaks 2011-03-04 09:52:12 -07:00
opennebula Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
openvz remove no longer needed calls to virReportOOMError 2011-02-17 16:59:14 -07:00
phyp sysinfo: define internal driver API 2011-02-08 19:25:30 -07:00
qemu qemu: Support vram for video of qxl type 2011-03-06 22:00:27 +08:00
remote fixes for several memory leaks 2011-03-04 09:52:12 -07:00
secret Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
security Pass virSecurityManagerPtr to virSecurityDAC{Set, Restore}ChardevCallback 2011-03-03 08:08:16 -07:00
storage Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
test maint: kill all remaining uses of old DEBUG macro 2011-02-21 08:46:52 -07:00
uml Allow hash tables to use generic pointers as keys 2011-02-25 13:00:54 +00:00
util unlock eventLoop before calling callback function 2011-03-07 10:05:17 -07:00
vbox Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
vmware sysinfo: define internal driver API 2011-02-08 19:25:30 -07:00
vmx Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
xen Allow hash tables to use generic pointers as keys 2011-02-25 13:00:54 +00:00
xenapi sysinfo: define internal driver API 2011-02-08 19:25:30 -07:00
xenxs Add support for multiple serial ports into the Xen driver 2011-02-25 11:33:27 -07:00
.gitignore util: add missing export 2010-10-12 09:42:18 -06:00
datatypes.c maint: kill all remaining uses of old DEBUG macro 2011-02-21 08:46:52 -07:00
datatypes.h Remove all object hashtable caches from virConnectPtr 2011-02-21 11:50:46 +00:00
driver.c maint: kill all remaining uses of old DEBUG macro 2011-02-21 08:46:52 -07:00
driver.h Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
fdstream.c build: avoid close, system 2011-01-29 10:36:45 -07:00
fdstream.h Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
gnutls_1_0_compat.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
internal.h Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
libvirt_bridge.syms Replace brSetInetAddress/brSetInetNetmask with brAddInetAddress 2010-12-23 15:53:26 -05:00
libvirt_daemon.syms Export conditional state driver symbols only when they are defined 2010-03-23 02:05:18 +01:00
libvirt_driver_modules.syms Move --with-driver-modules symbols into a separate sym file 2009-01-05 14:06:41 +00:00
libvirt_internal.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
libvirt_linux.syms migrate linux-specific symbol names into their own sym file 2009-01-05 14:08:26 +00:00
libvirt_macvtap.syms Fix undefined symbol errors when macvtap support is disabled 2010-12-01 17:08:08 +01:00
libvirt_nwfilter.syms Some NWFilter symbols are conditional and have to be exported conditional 2010-04-23 19:51:00 +02:00
libvirt_private.syms Expose event loop implementation as a public API 2011-03-07 14:16:13 +00:00
libvirt_public.syms Expose event loop implementation as a public API 2011-03-07 14:16:13 +00:00
libvirt_qemu.syms Qemu Monitor API entry point. 2010-07-23 17:30:14 -04:00
libvirt_vmx.syms esx: Move VMX handling code out of the driver directory 2010-12-21 22:40:17 +01:00
libvirt-qemu.c maint: kill all remaining uses of old DEBUG macro 2011-02-21 08:46:52 -07:00
libvirt.c maint: kill all remaining uses of old DEBUG macro 2011-02-21 08:46:52 -07:00
Makefile.am Move event code out of the daemon/ into src/util/ 2011-03-07 14:16:13 +00:00
nodeinfo.c Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
nodeinfo.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
README Update src/README 2011-02-12 17:10:30 +01:00
remote_protocol-structs sysinfo: implement the remote protocol 2011-02-08 19:29:46 -07:00

       libvirt library code README
       ===========================

The directory provides the bulk of the libvirt codebase. Everything
except for the libvirtd daemon and client tools. The build uses a
large number of libtool convenience libraries - one for each child
directory, and then links them together for the final libvirt.so,
although some bits get linked directly to libvirtd daemon instead.

The files directly in this directory are supporting the public API
entry points & data structures.

There are two core shared modules to be aware of:

 * util/  - a collection of shared APIs that can be used by any
            code. This directory is always in the include path
            for all things built

 * conf/  - APIs for parsing / manipulating all the official XML
            files used by the public API. This directory is only
            in the include path for driver implementation modules

 * vmx/   - VMware VMX config handling (used by esx/ and vmware/)


Then there are the hypervisor implementations:

 * esx/          - VMware ESX and GSX support using vSphere API over SOAP
 * lxc/          - Linux Native Containers
 * opennebula/   - Open Nebula using XMLRPC
 * openvz/       - OpenVZ containers using cli tools
 * phyp/         - IBM Power Hypervisor using CLI tools over SSH
 * qemu/         - QEMU / KVM using qemu CLI/monitor
 * remote/       - Generic libvirt native RPC client
 * test/         - A "mock" driver for testing
 * uml/          - User Mode Linux
 * vbox/         - Virtual Box using native API
 * vmware/       - VMware Workstation and Player using the vmrun tool
 * xen/          - Xen using hypercalls, XenD SEXPR & XenStore
 * xenapi/       - Xen using libxenserver


Finally some secondary drivers that are shared for several HVs.
Currently these are used by LXC, OpenVZ, QEMU, UML and Xen drivers.
The ESX, OpenNebula, Power Hypervisor, Remote, Test & VirtualBox
drivers all implement the secondary drivers directly

 * cpu/          - CPU feature management
 * interface/    - Host network interface management
 * network/      - Virtual NAT networking
 * nwfilter/     - Network traffic filtering rules
 * node_device/  - Host device enumeration
 * secret/       - Secret management
 * security/     - Mandatory access control drivers
 * storage/      - Storage management drivers


Since both the hypervisor and secondary drivers can be built as
dlopen()able modules, it is *FORBIDDEN* to have build dependencies
between these directories. Drivers are only allowed to depend on
the public API, and the internal APIs in the util/ and conf/
directories