qemu/hw/core
Denis V. Lunev 9588c5897b block: add missed aio_context_acquire into release_drive
Recently we expirience hang with iothreads enabled with the following
call trace:
Thread 1 (Thread 0x7fa95efebc80 (LWP 177117)):
0  ppoll () from /lib64/libc.so.6
2  qemu_poll_ns () at qemu-timer.c:313
3  aio_poll () at aio-posix.c:457
4  bdrv_flush () at block/io.c:2641
5  bdrv_close () at block.c:2143
6  bdrv_delete () at block.c:2352
7  bdrv_unref () at block.c:3429
8  blk_remove_bs () at block/block-backend.c:427
9  blk_delete () at block/block-backend.c:178
10 blk_unref () at block/block-backend.c:226
11 object_property_del_all () at qom/object.c:399
12 object_finalize () at qom/object.c:461
13 object_unref () at qom/object.c:898
14 object_property_del_child () at qom/object.c:422
15 qmp_marshal_device_del () at qmp-marshal.c:1145
16 handle_qmp_command () at /usr/src/debug/qemu-2.6.0/monitor.c:3929

Technically bdrv_flush() stucks in
    while (rwco.ret == NOT_DONE) {
        aio_poll(aio_context, true);
    }
but rwco.ret is equal to 0 thus we have missed wakeup. Code investigation
reveals that we do not have performed aio_context_acquire() on this call
stack.

This patch adds missed lock.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
CC: Eric Blake <eblake@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
Message-id: 1490717566-25516-1-git-send-email-den@openvz.org
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2017-04-03 17:11:39 +02:00
..
bus.c bus: do not unref hotplug handler 2017-03-01 11:51:28 +04:00
empty_slot.c
fw-path-provider.c
generic-loader.c hw: Fix typos found by codespell 2017-01-24 23:26:52 +03:00
hotplug.c qdev: hotplug: drop HotplugHandler.post_plug callback 2016-11-15 17:20:37 +02:00
irq.c tcg: drop global lock during TCG code execution 2017-02-24 10:32:45 +00:00
loader-fit.c loader: Support Flattened Image Trees (FIT images) 2017-02-21 23:47:40 +00:00
loader.c elf-loader: Allow late loading of elf 2017-02-28 12:04:48 +01:00
machine.c numa,spapr: align default numa node memory size to 256MB 2017-03-22 11:32:42 +11:00
Makefile.objs loader: Support Flattened Image Trees (FIT images) 2017-02-21 23:47:40 +00:00
nmi.c
null-machine.c hw/core/null-machine: Add the possibility to instantiate a CPU and RAM 2017-01-23 21:26:27 -02:00
or-irq.c hw/core/or-irq: Mark the device with cannot_instantiate_with_device_add_yet 2017-02-28 09:03:38 +03:00
platform-bus.c sysbus: Remove ignored return value of FindSysbusDeviceFunc 2016-09-27 17:03:34 -03:00
ptimer.c qemu-timer: do not include sysemu/cpus.h from util/qemu-timer.h 2017-03-14 13:28:18 +01:00
qdev-properties-system.c block: add missed aio_context_acquire into release_drive 2017-04-03 17:11:39 +02:00
qdev-properties.c hw: Fix typos found by codespell 2017-01-24 23:26:52 +03:00
qdev.c Migration pull 2017-03-02 17:39:12 +00:00
register.c register: fix incorrect read mask 2017-02-28 09:03:38 +03:00
reset.c hw: move reset handlers from vl.c to hw/core 2017-01-16 17:52:35 +01:00
stream.c
sysbus.c
uboot_image.h