]> Git Repo - qemu.git/commitdiff
blockdev: acquire AioContext in do_qmp_query_block_jobs_one()
authorStefan Hajnoczi <[email protected]>
Tue, 21 Oct 2014 11:03:51 +0000 (12:03 +0100)
committerStefan Hajnoczi <[email protected]>
Mon, 3 Nov 2014 11:41:49 +0000 (11:41 +0000)
Make sure that query-block-jobs acquires the BlockDriverState
AioContext so that the blockjob isn't running in another thread while we
access its state.

Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 1413889440[email protected]

blockdev.c

index 501473da69e52b2a2f5f1ddb3c167b99ffa5e39d..40fc5d624fcb023e05ab41953b81db2061200393 100644 (file)
@@ -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;
This page took 0.029505 seconds and 4 git commands to generate.