From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xgtod-0002oa-BE for qemu-devel@nongnu.org; Wed, 22 Oct 2014 07:11:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgtoX-0002OI-1R for qemu-devel@nongnu.org; Wed, 22 Oct 2014 07:10:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgtoW-0002OA-PM for qemu-devel@nongnu.org; Wed, 22 Oct 2014 07:10:48 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9MBAltx003963 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 22 Oct 2014 07:10:48 -0400 Message-ID: <544790B5.5040006@redhat.com> Date: Wed, 22 Oct 2014 13:10:45 +0200 From: Max Reitz MIME-Version: 1.0 References: <1413889440-32577-1-git-send-email-stefanha@redhat.com> <1413889440-32577-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1413889440-32577-3-git-send-email-stefanha@redhat.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 02/11] blockdev: acquire AioContext in do_qmp_query_block_jobs_one() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Fam Zheng 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 > Reviewed-by: Max Reitz > --- > 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