aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-08-17 18:54:18 +0200
committerKevin Wolf <kwolf@redhat.com>2018-09-25 15:50:15 +0200
commitaa1361d54aac43094b98024b8b6c804eb6e41661 (patch)
tree5ae88b570aa3073f13e15c57e0594633b6d42584 /include
parentae23dde9dd486e57e152a0ebc9802caddedc45fc (diff)
downloadqemu-aa1361d54aac43094b98024b8b6c804eb6e41661.zip
qemu-aa1361d54aac43094b98024b8b6c804eb6e41661.tar.gz
qemu-aa1361d54aac43094b98024b8b6c804eb6e41661.tar.bz2
block: Add missing locking in bdrv_co_drain_bh_cb()
bdrv_do_drained_begin/end() assume that they are called with the AioContext lock of bs held. If we call drain functions from a coroutine with the AioContext lock held, we yield and schedule a BH to move out of coroutine context. This means that the lock for the home context of the coroutine is released and must be re-acquired in the bottom half. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/coroutine.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h
index 6f8a487..9801e7f 100644
--- a/include/qemu/coroutine.h
+++ b/include/qemu/coroutine.h
@@ -90,6 +90,11 @@ void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co);
void coroutine_fn qemu_coroutine_yield(void);
/**
+ * Get the AioContext of the given coroutine
+ */
+AioContext *coroutine_fn qemu_coroutine_get_aio_context(Coroutine *co);
+
+/**
* Get the currently executing coroutine
*/
Coroutine *coroutine_fn qemu_coroutine_self(void);