qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Jeff Cody <jcody@redhat.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block: fix external snapshot abort permission error
Date: Wed, 7 Jun 2017 10:37:13 -0500	[thread overview]
Message-ID: <f10688f7-0e86-38b5-fae7-31911a9d66e8@redhat.com> (raw)
In-Reply-To: <d5b487b58c2c6b3e68de0e858b84877434f05c76.1496843678.git.jcody@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]

On 06/07/2017 08:55 AM, Jeff Cody wrote:
> In external_snapshot_abort(), we try to undo what was done in
> external_snapshot_prepare() calling bdrv_replace_node() to swap the
> nodes back.  However, we receive a permissions error as writers are
> blocked on the old node, which is now the new node backing file.
> 
> An easy fix (initially suggested by Kevin Wolf) is to call
> bdrv_set_backing_hd() on the new node, to set the backing node to NULL.
> 
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
>  blockdev.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

> diff --git a/blockdev.c b/blockdev.c
> index 892d768..6472548 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -1803,7 +1803,11 @@ static void external_snapshot_abort(BlkActionState *common)
>                               DO_UPCAST(ExternalSnapshotState, common, common);
>      if (state->new_bs) {
>          if (state->overlay_appended) {
> +            bdrv_ref(state->old_bs);   /* we can't let bdrv_set_backind_hd()
> +                                          close state->old_bs; we need it */
> +            bdrv_set_backing_hd(state->new_bs, NULL, &error_abort);
>              bdrv_replace_node(state->new_bs, state->old_bs, &error_abort);
> +            bdrv_unref(state->old_bs); /* bdrv_replace_node() ref'ed old_bs */
>          }
>      }
>  }
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2017-06-07 15:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07 13:55 [Qemu-devel] [PATCH] block: fix external snapshot abort permission error Jeff Cody
2017-06-07 15:37 ` Eric Blake [this message]
2017-06-07 16:52 ` Kevin Wolf

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=f10688f7-0e86-38b5-fae7-31911a9d66e8@redhat.com \
    --to=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).