mirror_qemu/include
Eric Blake 61bc846d8c nbd: Grab aio context lock in more places
When iothreads are in use, the failure to grab the aio context results
in an assertion failure when trying to unlock things during blk_unref,
when trying to unlock a mutex that was not locked.  In short, all
calls to nbd_export_put need to done while within the correct aio
context.  But since nbd_export_put can recursively reach itself via
nbd_export_close, and recursively grabbing the context would deadlock,
we can't do the context grab directly in those functions, but must do
so in their callers.

Hoist the use of the correct aio_context from nbd_export_new() to its
caller qmp_nbd_server_add().  Then tweak qmp_nbd_server_remove(),
nbd_eject_notifier(), and nbd_esport_close_all() to grab the right
context, so that all callers during qemu now own the context before
nbd_export_put() can call blk_unref().

Remaining uses in qemu-nbd don't matter (since that use case does not
support iothreads).

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190917023917.32226-1-eblake@redhat.com>
Reviewed-by: Sergio Lopez <slp@redhat.com>
2019-09-24 07:30:19 -05:00
..
authz Include generated QAPI headers less 2019-08-16 13:31:51 +02:00
block nbd: Grab aio context lock in more places 2019-09-24 07:30:19 -05:00
chardev Include qemu/main-loop.h less 2019-08-16 13:31:52 +02:00
crypto crypto: define cleanup functions for use with g_autoptr 2019-08-22 10:47:12 +01:00
disas include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
exec memory: inline and optimize devend_memop 2019-09-16 13:47:37 +02:00
fpu fpu: make softfloat-macros "self-contained" 2019-08-19 12:07:13 +01:00
hw pc: Add an SMB0 ACPI device to q35 2019-09-20 14:09:24 -05:00
io socket: Add num connections to qio_net_listener_open_sync() 2019-09-03 23:24:42 +02:00
libdecnumber include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
migration migration: register_savevm_live doesn't need dev 2019-09-12 11:15:03 +01:00
monitor Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
net Include qemu/queue.h slightly less 2019-08-16 13:31:52 +02:00
qapi qapi: Split error.json off common.json 2019-08-16 13:31:51 +02:00
qemu cutils: Move size_to_str() from "qemu-common.h" to "qemu/cutils.h" 2019-09-19 11:57:34 +02:00
qom hw/core: Move cpu.c, cpu.h from qom/ to hw/core/ 2019-08-21 13:24:01 +02:00
scsi scsi: explicitly list guest-recoverable sense codes 2019-07-15 11:20:42 +02:00
standard-headers kvm: i386: halt poll control MSR support 2019-08-20 17:26:17 +02:00
sysemu kvm: Fix typo in header of kvm_device_access() 2019-09-19 14:42:31 +02:00
ui ui/egl: fix framebuffer reads 2019-09-17 13:42:02 +02:00
elf.h linux-user: elf: ELF_HWCAP for s390x 2019-06-07 14:53:26 +02:00
glib-compat.h glib: bump min required glib library version to 2.48 2019-08-22 10:46:34 +01:00
qemu-common.h cutils: Move size_to_str() from "qemu-common.h" to "qemu/cutils.h" 2019-09-19 11:57:34 +02:00
qemu-io.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
trace-tcg.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00