qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 02/11] blockdev: acquire AioContext in do_qmp


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH v2 02/11] blockdev: acquire AioContext in do_qmp_query_block_jobs_one()
Date: Wed, 22 Oct 2014 13:10:45 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 2014-10-21 at 13:03, Stefan Hajnoczi wrote:
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 <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
  blockdev.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 1c7dab4..fd55904 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2649,14 +2649,19 @@ fail:
  static void do_qmp_query_block_jobs_one(void *opaque, BlockDriverState *bs)
  {
      BlockJobInfoList **prev = opaque;
-    BlockJob *job = bs->job;
+    AioContext *aio_context;
+
+    aio_context = bdrv_get_aio_context(bs);
+    aio_context_acquire(aio_context);
- if (job) {
+    if (bs->job) {
          BlockJobInfoList *elem = g_new0(BlockJobInfoList, 1);
          elem->value = block_job_query(bs->job);
          (*prev)->next = elem;
          *prev = elem;
      }
+
+    aio_context_release(aio_context);
  }
BlockJobInfoList *qmp_query_block_jobs(Error **errp)

As already said in my review for v1, this conflicts with Markus's patch "block: Eliminate bdrv_iterate(), use bdrv_next()"; it's still not in master, but by now the pull request has been sent so I guess it's up to you to resolve it. ;-)

Max



reply via email to

[Prev in Thread] Current Thread [Next in Thread]