libvirt/src/util
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
..
authhelper.c esx: Move username and password helper functions to authhelper.c 2010-03-16 20:15:32 +01:00
authhelper.h esx: Move username and password helper functions to authhelper.c 2010-03-16 20:15:32 +01:00
bitmap.c util: Add API for converting virBitmap into printable string 2011-02-24 12:03:04 +01:00
bitmap.h Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
bridge.c Allow brAddTap to create a tap device that is down 2011-02-17 13:36:22 -05:00
bridge.h Allow brAddTap to create a tap device that is down 2011-02-17 13:36:22 -05:00
buf.c xend: Escape reserved sexpr characters 2010-11-22 16:43:29 -05:00
buf.h xend: Escape reserved sexpr characters 2010-11-22 16:43:29 -05:00
cgroup.c Add check for kill() to fix build of cgroups on win32 2011-02-28 14:13:58 +00:00
cgroup.h Add APIs for killing off processes inside a cgroup 2011-02-25 14:21:30 +00:00
command.c Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
command.h command: ease use with virBuffer, and fix qemu leak 2010-12-10 14:37:09 -07:00
conf.c fixes for several memory leaks 2011-03-04 09:52:12 -07:00
conf.h esx: Allow '-' in VMX entry names 2010-09-23 10:37:10 +02:00
dnsmasq.c deprecate fclose() and introduce VIR_{FORCE_}FCLOSE() 2010-11-16 21:13:29 -05:00
dnsmasq.h Convert virNetwork to use virSocketAddr everywhere 2010-10-22 12:07:02 +01:00
ebtables.c qemu: plug memory leak 2010-12-01 10:00:10 -07:00
ebtables.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
event_poll.c unlock eventLoop before calling callback function 2011-03-07 10:05:17 -07:00
event_poll.h Move event code out of the daemon/ into src/util/ 2011-03-07 14:16:13 +00:00
event.c Expose event loop implementation as a public API 2011-03-07 14:16:13 +00:00
event.h Fix documentation for virEventAddTimeout() 2010-10-26 10:23:03 +02:00
files.c deprecate fclose() and introduce VIR_{FORCE_}FCLOSE() 2010-11-16 21:13:29 -05:00
files.h Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
hash.c util: Allow removing hash entries in virHashForEach 2011-03-03 15:22:16 +01:00
hash.h Allow hash tables to use generic pointers as keys 2011-02-25 13:00:54 +00:00
hooks.c Remove bogus includes 2010-12-02 16:00:47 -07:00
hooks.h Add hook utilities 2010-03-29 18:21:04 +02:00
hostusb.c hostusb: Properly handle 'usbX' sysfs files 2010-06-02 09:57:55 -04:00
hostusb.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
interface.c bye to close(), welcome to VIR_(FORCE_)CLOSE() 2010-11-09 15:48:48 -05:00
interface.h add 802.1Qbh and 802.1Qbg handling 2010-06-02 21:35:22 -04:00
iptables.c Log an error on attempts to add a NAT rule for non-IPv4 addresses 2011-01-05 11:59:47 -05:00
iptables.h Update iptables.c to also support ip6tables. 2010-12-23 15:54:32 -05:00
json.c build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
json.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
logging.c Cleaning up some of the logging code 2011-03-07 21:23:53 +08:00
logging.h Add an an internal API for emergency dump of debug buffer 2011-03-04 22:43:55 +08:00
macvtap.c 802.1Qbh: Delay IFF_UP'ing interface until migration final stage 2011-02-22 07:48:54 -05:00
macvtap.h Prefer C style comments over C++ ones 2011-01-29 00:59:45 +01:00
memory.c build: fix cygwin strerror_r failure 2011-02-11 12:32:17 -07:00
memory.h Fix conflicts with glibc globals 2011-02-03 08:58:45 -07:00
network.c network: plug unininitialized read found by valgrind 2011-01-10 15:22:57 -07:00
network.h Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
pci.c Create file in virFileWriteStr() if it doesn't exist 2010-12-03 08:08:22 -07:00
pci.h pciResetDevice: use inactive devices to determine safe reset 2010-07-26 18:43:04 +02:00
processinfo.c build: update gnulib 2010-05-06 14:35:38 -06:00
processinfo.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
qparams.c qparams.c: do not skip va_end, twice 2010-02-19 11:52:04 +01:00
qparams.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
sexpr.c Moved some SEXPR functions from xen-unified 2011-02-21 10:50:18 -07:00
sexpr.h Moved some SEXPR functions from xen-unified 2011-02-21 10:50:18 -07:00
stats_linux.c deprecate fclose() and introduce VIR_{FORCE_}FCLOSE() 2010-11-16 21:13:29 -05:00
stats_linux.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
storage_file.c fixes for several memory leaks 2011-03-04 09:52:12 -07:00
storage_file.h Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
sysinfo.c sysinfo: refactor xml formatting 2011-02-08 19:37:21 -07:00
sysinfo.h sysinfo: refactor xml formatting 2011-02-08 19:37:21 -07:00
threadpool.c Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
threadpool.h threadpool: allow NULL jobdata 2011-01-03 14:45:00 -07:00
threads-pthread.c Fix leak of mutex attributes in POSIX threads impl 2011-02-15 11:42:32 +00:00
threads-pthread.h Introduce portability APIs for creating threads 2010-11-11 16:03:09 +00:00
threads-win32.c threads: add virThreadID for debugging use 2010-12-06 09:50:20 -07:00
threads-win32.h Introduce portability APIs for creating threads 2010-11-11 16:03:09 +00:00
threads.c build: avoid pthreads-win32 on mingw 2010-06-10 06:05:31 -06:00
threads.h Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
util.c util: correct retry path in virFileOperation 2011-03-03 08:12:08 -07:00
util.h Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
uuid.c bye to close(), welcome to VIR_(FORCE_)CLOSE() 2010-11-09 15:48:48 -05:00
uuid.h Expose a host UUID in the capabilities XML 2010-05-25 17:09:18 +01:00
virtaudit.c util: add virVasprintf 2010-12-02 11:23:15 -07:00
virtaudit.h Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
virterror_internal.h Filter out certain expected error messages from libvirtd 2011-01-26 14:54:23 +00:00
virterror.c Expose event loop implementation as a public API 2011-03-07 14:16:13 +00:00
xml.c fixes for several memory leaks 2011-03-04 09:52:12 -07:00
xml.h util: add missing string->integer conversion functions 2011-01-13 15:10:40 -07:00