qemu-e2k/include/sysemu
Fam Zheng dce8921b2b iothread: Stop threads before main() quits
Right after main_loop ends, we release various things but keep iothread
alive. The latter is not prepared to the sudden change of resources.

Specifically, after bdrv_close_all(), virtio-scsi dataplane get a
surprise at the empty BlockBackend:

(gdb) bt
    at /usr/src/debug/qemu-2.6.0/hw/scsi/virtio-scsi.c:543
    at /usr/src/debug/qemu-2.6.0/hw/scsi/virtio-scsi.c:577

It is because the d->conf.blk->root is set to NULL, then
blk_get_aio_context() returns qemu_aio_context, whereas s->ctx is still
pointing to the iothread:

    hw/scsi/virtio-scsi.c:543:

    if (s->dataplane_started) {
        assert(blk_get_aio_context(d->conf.blk) == s->ctx);
    }

To fix this, let's stop iothreads before doing bdrv_close_all().

Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1473326931-9699-1-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-09-13 11:00:57 +01:00
..
accel.h accel: make configure_accelerator return void 2016-05-18 15:04:27 +03:00
arch_init.h qmp: add QMP interface "query-cpu-model-baseline" 2016-09-06 17:06:51 +02:00
balloon.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
block-backend.h block: switch blk_write_compressed() to byte-based interface 2016-09-05 19:06:47 +02:00
blockdev.h include: Clean up includes 2016-02-23 12:43:05 +00:00
bt.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
char.h char: add chr_wait_connected callback 2016-07-29 00:33:48 +03:00
cpus.h include: move CPU-related definitions out of qemu-common.h 2016-05-19 13:08:04 +02:00
device_tree.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
dma.h dma-helpers: change BlockBackend to opaque value in DMAIOFunc 2016-05-25 19:04:11 +02:00
dump-arch.h dump: allow target to set the physical base 2016-01-15 14:40:25 +00:00
dump.h DumpState: adding total_size and written_size fields 2016-02-22 18:40:28 +01:00
hostmem.h * SCSI scanner support 2016-07-14 13:44:06 +01:00
iothread.h iothread: Stop threads before main() quits 2016-09-13 11:00:57 +01:00
kvm_int.h
kvm.h kvm-irqchip: do explicit commit when update irq 2016-07-21 20:44:19 +03:00
memory_mapping.h Use scripts/clean-includes to drop redundant qemu/typedefs.h 2016-03-22 22:20:16 +01:00
numa.h include: Clean up includes 2016-02-23 12:43:05 +00:00
os-posix.h os-posix: include sys/mman.h 2016-06-16 18:39:03 +02:00
os-win32.h osdep: remove use of socket_error() from all code 2016-03-10 17:19:34 +00:00
qtest.h include: Clean up includes 2016-02-23 12:43:05 +00:00
replay.h replay: introduce block devices record/replay 2016-03-30 12:15:57 +02:00
rng-random.h rng-random: rename RndRandom to RngRandom 2016-05-23 12:18:43 +05:30
rng.h rng: switch request queue to QSIMPLEQ 2016-03-08 12:54:14 +05:30
seccomp.h include: Clean up includes 2016-02-23 12:43:05 +00:00
sysemu.h hw/pci: delay bus_master_enable_region initialization 2016-07-04 14:50:01 +03:00
tpm_backend_int.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
tpm_backend.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
tpm.h
watchdog.h watchdog: introduction of get_watchdog_action 2016-01-27 15:34:47 +01:00
xen-mapcache.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00