diff options
author | Eric Blake | 2019-09-17 04:39:17 +0200 |
---|---|---|
committer | Eric Blake | 2019-09-24 14:30:19 +0200 |
commit | 61bc846d8c58535af6884b637a4005dd6111ea95 (patch) | |
tree | a5c98306bdac3b6311aa472745ec81879a3cbdb2 /include/block | |
parent | nbd/server: attach client channel to the export's AioContext (diff) | |
download | qemu-61bc846d8c58535af6884b637a4005dd6111ea95.tar.gz qemu-61bc846d8c58535af6884b637a4005dd6111ea95.tar.xz qemu-61bc846d8c58535af6884b637a4005dd6111ea95.zip |
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>
Diffstat (limited to 'include/block')
-rw-r--r-- | include/block/nbd.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/block/nbd.h b/include/block/nbd.h index 21550747cf..316fd705a9 100644 --- a/include/block/nbd.h +++ b/include/block/nbd.h @@ -340,6 +340,7 @@ void nbd_export_put(NBDExport *exp); BlockBackend *nbd_export_get_blockdev(NBDExport *exp); +AioContext *nbd_export_aio_context(NBDExport *exp); NBDExport *nbd_export_find(const char *name); void nbd_export_close_all(void); |