summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blockdev.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c
index 501473da69..40fc5d624f 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2628,12 +2628,18 @@ BlockJobInfoList *qmp_query_block_jobs(Error **errp)
BlockDriverState *bs;
for (bs = bdrv_next(NULL); bs; bs = bdrv_next(bs)) {
+ AioContext *aio_context = bdrv_get_aio_context(bs);
+
+ aio_context_acquire(aio_context);
+
if (bs->job) {
BlockJobInfoList *elem = g_new0(BlockJobInfoList, 1);
elem->value = block_job_query(bs->job);
*p_next = elem;
p_next = &elem->next;
}
+
+ aio_context_release(aio_context);
}
return head;