From: Max Reitz <mreitz@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <famz@redhat.com>
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 [thread overview]
Message-ID: <544790B5.5040006@redhat.com> (raw)
In-Reply-To: <1413889440-32577-3-git-send-email-stefanha@redhat.com>
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 <stefanha@redhat.com>
> Reviewed-by: Max Reitz <mreitz@redhat.com>
> ---
> 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
next prev parent reply other threads:[~2014-10-22 11:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 11:03 [Qemu-devel] [PATCH v2 00/11] block: allow blockjobs to coexist with dataplane Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 01/11] block: acquire AioContext in generic blockjob QMP commands Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 02/11] blockdev: acquire AioContext in do_qmp_query_block_jobs_one() Stefan Hajnoczi
2014-10-22 11:10 ` Max Reitz [this message]
2014-10-29 12:10 ` Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 03/11] blockdev: acquire AioContext in blockdev_mark_auto_del() Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 04/11] blockdev: add note that block_job_cb() must be thread-safe Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 05/11] blockjob: add block_job_defer_to_main_loop() Stefan Hajnoczi
2014-10-21 11:24 ` Max Reitz
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 06/11] block: add bdrv_drain() Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 07/11] block: let backup blockjob run in BDS AioContext Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 08/11] block: let stream " Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 09/11] block: let mirror " Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 10/11] block: let commit " Stefan Hajnoczi
2014-10-21 11:28 ` Max Reitz
2014-10-21 11:04 ` [Qemu-devel] [PATCH v2 11/11] block: declare blockjobs and dataplane friends! Stefan Hajnoczi
2014-10-29 12:11 ` [Qemu-devel] [PATCH v2 00/11] block: allow blockjobs to coexist with dataplane Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=544790B5.5040006@redhat.com \
--to=mreitz@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).