On 04.08.2014 17:56, Stefan Hajnoczi wrote:
If two Linux AIO request completions are fetched in the same
io_getevents() call, QEMU will deadlock if request A's callback waits
for request B to complete using an aio_poll() loop. This was reported
to happen with the mirror blockjob.
This patch moves completion processing into a BH and makes it resumable.
Nested event loops can resume completion processing so that request B
will complete and the deadlock will not occur.
Cc: Kevin Wolf <kw...@redhat.com>
Cc: Paolo Bonzini <pbonz...@redhat.com>
Cc: Ming Lei <ming....@canonical.com>
Cc: Marcin Gibuła <m.gib...@beyond.pl>
Reported-by: Marcin Gibuła <m.gib...@beyond.pl>
Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>
Still hangs...
Backtrace still looks like this:
Thread 1 (Thread 0x7f3d5313a900 (LWP 17440)):
#0 0x00007f3d4f38f286 in ppoll () from /lib64/libc.so.6
#1 0x00007f3d5347465b in ppoll (__ss=0x0, __timeout=0x0,
__nfds=<optimized out>, __fds=<optimized out>) at
/usr/include/bits/poll2.h:77
#2 qemu_poll_ns (fds=<optimized out>, nfds=<optimized out>,
timeout=<optimized out>)
at
/var/tmp/portage/app-emulation/qemu-2.1.0/work/qemu-2.1.0/qemu-timer.c:314
#3 0x00007f3d53475970 in aio_poll (ctx=ctx@entry=0x7f3d54270c00,
blocking=blocking@entry=true)
at
/var/tmp/portage/app-emulation/qemu-2.1.0/work/qemu-2.1.0/aio-posix.c:250
#4 0x00007f3d534695e7 in bdrv_drain_all () at
/var/tmp/portage/app-emulation/qemu-2.1.0/work/qemu-2.1.0/block.c:1924
#5 0x00007f3d5346fe1f in bdrv_close (bs=bs@entry=0x7f3d5579b340) at
/var/tmp/portage/app-emulation/qemu-2.1.0/work/qemu-2.1.0/block.c:1820
#6 0x00007f3d53470047 in bdrv_delete (bs=0x7f3d5579b340) at
/var/tmp/portage/app-emulation/qemu-2.1.0/work/qemu-2.1.0/block.c:2094
#7 bdrv_unref (bs=0x7f3d5579b340) at
/var/tmp/portage/app-emulation/qemu-2.1.0/work/qemu-2.1.0/block.c:5376
#8 0x00007f3d5347030b in bdrv_drop_intermediate
(active=active@entry=0x7f3d54635e20, top=top@entry=0x7f3d5579b340,
base=base@entry=0x7f3d54d956b0,
backing_file_str=0x7f3d54d95700
"/mnt/nfs/volumes/7c13c27f-0c48-4676-b075-6e8a3325383e/3785abe6-d2df-49da-9cba-e15cfce8e2af.qcow2")
at
/var/tmp/portage/app-emulation/qemu-2.1.0/work/qemu-2.1.0/block.c:2643
#9 0x00007f3d5335121a in commit_run (opaque=0x7f3d545cdac0) at
/var/tmp/portage/app-emulation/qemu-2.1.0/work/qemu-2.1.0/block/commit.c:145
#10 0x00007f3d5347ebca in coroutine_trampoline (i0=<optimized out>,
i1=<optimized out>)
at
/var/tmp/portage/app-emulation/qemu-2.1.0/work/qemu-2.1.0/coroutine-ucontext.c:118
#11 0x00007f3d4f2f49f0 in ?? () from /lib64/libc.so.6
#12 0x00007fff27d5ef50 in ?? ()
#13 0x0000000000000000 in ?? ()
--
mg