qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	qemu-block@nongnu.org, Ed Swierk <eswierk@skyportsystems.com>,
	Max Reitz <mreitz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-2.9 1/5] block: Fix unpaired aio_disable_external in external snapshot
Date: Thu, 6 Apr 2017 16:36:07 +0200	[thread overview]
Message-ID: <20170406143607.GH4341@noname.redhat.com> (raw)
In-Reply-To: <20170406142527.25835-2-famz@redhat.com>

Am 06.04.2017 um 16:25 hat Fam Zheng geschrieben:
> bdrv_replace_child_noperm tries to hand over the quiesce_counter state
> from old bs to the new one, but if they are not on the same aio context
> this causes unbalance.
> 
> Fix this by forcing callers to move the aio context first, and assert
> it.
> 
> Reported-by: Ed Swierk <eswierk@skyportsystems.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block.c    | 3 +++
>  blockdev.c | 4 ++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/block.c b/block.c
> index 927ba89..8893ac1 100644
> --- a/block.c
> +++ b/block.c
> @@ -1752,6 +1752,9 @@ static void bdrv_replace_child_noperm(BdrvChild *child,
>  {
>      BlockDriverState *old_bs = child->bs;
>  
> +    if (old_bs && new_bs) {
> +        assert(bdrv_get_aio_context(old_bs) == bdrv_get_aio_context(new_bs));
> +    }
>      if (old_bs) {
>          if (old_bs->quiesce_counter && child->role->drained_end) {
>              child->role->drained_end(child);

Can we move this to a separate patch and also add this hunk for
asserting the same thing for newly attached child nodes:

@@ -1852,6 +1855,7 @@ BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs,
     bdrv_get_cumulative_perm(parent_bs, &perm, &shared_perm);
 
     assert(parent_bs->drv);
+    assert(bdrv_get_aio_context(parent_bs) == bdrv_get_aio_context(child_bs));
     parent_bs->drv->bdrv_child_perm(parent_bs, NULL, child_role,
                                     perm, shared_perm, &perm, &shared_perm);

Kevin

  parent reply	other threads:[~2017-04-06 14:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 14:25 [Qemu-devel] [PATCH for-2.9 0/5] block: Fixes regarding dataplane and management operations Fam Zheng
2017-04-06 14:25 ` [Qemu-devel] [PATCH for-2.9 1/5] block: Fix unpaired aio_disable_external in external snapshot Fam Zheng
2017-04-06 14:36   ` Eric Blake
2017-04-06 14:36   ` Kevin Wolf [this message]
2017-04-06 23:38     ` Fam Zheng
2017-04-06 14:25 ` [Qemu-devel] [PATCH for-2.9 2/5] mirror: Fix aio context of mirror_top_bs Fam Zheng
2017-04-06 14:36   ` Eric Blake
2017-04-06 14:37   ` Kevin Wolf
2017-04-06 14:25 ` [Qemu-devel] [PATCH for-2.9 3/5] block: Quiesce old aio context during bdrv_set_aio_context Fam Zheng
2017-04-06 15:00   ` Eric Blake
2017-04-06 15:17   ` Kevin Wolf
2017-04-06 23:44     ` Fam Zheng
2017-04-07  8:15       ` Kevin Wolf
2017-04-06 14:25 ` [Qemu-devel] [PATCH for-2.9 4/5] block: Drain BH in bdrv_drained_begin Fam Zheng
2017-04-06 15:10   ` Eric Blake
2017-04-06 15:37   ` Kevin Wolf
2017-04-14  9:15     ` Paolo Bonzini
2017-04-06 14:25 ` [Qemu-devel] [PATCH for-2.9 5/5] coroutine: Explicitly specify AioContext when creating coroutine Fam Zheng
2017-04-06 15:34   ` Eric Blake
2017-04-06 16:20   ` Kevin Wolf
2017-04-07  8:34     ` Fam Zheng

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=20170406143607.GH4341@noname.redhat.com \
    --to=kwolf@redhat.com \
    --cc=eswierk@skyportsystems.com \
    --cc=famz@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).