aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-12-15 09:33:21 +0100
committerKevin Wolf <kwolf@redhat.com>2017-12-22 15:05:31 +0100
commit9a7e86c8048cecededa665b1ca55c7f217ed358c (patch)
tree2ee1eeb67e6db5a04562aebd9f9302b06c512e92 /block
parent8e77e0bceb4de0fe5cc912d5865b28a703f0f041 (diff)
block: Assert drain_all is only called from main AioContext
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/io.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/block/io.c b/block/io.c
index cf780c3cb0..b94740b8ff 100644
--- a/block/io.c
+++ b/block/io.c
@@ -330,6 +330,12 @@ void bdrv_drain_all_begin(void)
BdrvNextIterator it;
GSList *aio_ctxs = NULL, *ctx;
+ /* BDRV_POLL_WHILE() for a node can only be called from its own I/O thread
+ * or the main loop AioContext. We potentially use BDRV_POLL_WHILE() on
+ * nodes in several different AioContexts, so make sure we're in the main
+ * context. */
+ assert(qemu_get_current_aio_context() == qemu_get_aio_context());
+
block_job_pause_all();
for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {