qemu-e2k/include/block
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
..
accounting.h block/accounting: introduce latency histogram 2018-03-19 14:58:37 -05:00
aio-wait.h Clean up decorations and whitespace around header guards 2019-05-13 08:58:55 +02:00
aio.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
block.h block: Remove unused masks 2019-09-16 14:48:30 +02:00
block_backup.h block/backup: drop unused synchronization interface 2018-12-14 11:52:40 +01:00
block_int.h block/io: introduce bdrv_co_p{read, write}v_part 2019-08-27 14:58:42 +01:00
blockjob.h blockdev: blockdev_mark_auto_del: drop usage of bs->job 2019-06-18 16:41:10 +02:00
blockjob_int.h job: drop job_drain 2019-09-10 08:58:43 +02:00
dirty-bitmap.h qapi: implement block-dirty-bitmap-remove transaction action 2019-08-16 16:28:03 -04:00
nbd.h nbd: Grab aio context lock in more places 2019-09-24 07:30:19 -05:00
nvme.h nvme: add Get/Set Feature Timestamp support 2019-06-04 15:22:09 +02:00
qapi.h block/qapi: Clean up how we print to monitor or stdout 2019-04-18 22:18:59 +02:00
qdict.h block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
raw-aio.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
snapshot.h block/snapshot: remove bdrv_snapshot_delete_by_id_or_name 2019-02-25 15:03:18 +01:00
thread-pool.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
throttle-groups.h throttle-groups: fix restart coroutine iothread race 2019-01-24 10:02:28 +00:00
write-threshold.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00