qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, jcody@redhat.com,
	famz@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 03/10] mirror: Fix permissions for removing mirror_top_bs
Date: Mon,  6 Mar 2017 17:21:55 +0100	[thread overview]
Message-ID: <1488817322-11397-4-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1488817322-11397-1-git-send-email-kwolf@redhat.com>

mirror_top_bs takes write permissions on its backing file, which can
make it impossible to attach that backing file node to another parent.
However, this is exactly what needs to be done in order to remove
mirror_top_bs from the backing chain. So give up the write permission
first.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/mirror.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/block/mirror.c b/block/mirror.c
index c9185b3..001b5f0 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -566,8 +566,10 @@ static void mirror_exit(BlockJob *job, void *opaque)
 
     /* Remove the mirror filter driver from the graph. Before this, get rid of
      * the blockers on the intermediate nodes so that the resulting state is
-     * valid. */
+     * valid. Also give up permissions on mirror_top_bs->backing, which might
+     * block the removal. */
     block_job_remove_all_bdrv(job);
+    bdrv_child_set_perm(mirror_top_bs->backing, 0, BLK_PERM_ALL);
     bdrv_replace_in_backing_chain(mirror_top_bs, backing_bs(mirror_top_bs));
 
     /* We just changed the BDS the job BB refers to (with either or both of the
@@ -1234,6 +1236,7 @@ fail:
         block_job_unref(&s->common);
     }
 
+    bdrv_child_set_perm(mirror_top_bs->backing, 0, BLK_PERM_ALL);
     bdrv_replace_in_backing_chain(mirror_top_bs, backing_bs(mirror_top_bs));
 }
 
-- 
1.8.3.1

  parent reply	other threads:[~2017-03-06 16:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 16:21 [Qemu-devel] [PATCH 00/10] block: Op blocker fixes Kevin Wolf
2017-03-06 16:21 ` [Qemu-devel] [PATCH 01/10] commit: Fix error handling Kevin Wolf
2017-03-06 16:44   ` Philippe Mathieu-Daudé
2017-03-06 16:21 ` [Qemu-devel] [PATCH 02/10] mirror: Fix permission problem with 'replaces' Kevin Wolf
2017-03-06 20:01   ` Eric Blake
2017-03-06 16:21 ` Kevin Wolf [this message]
2017-03-06 20:13   ` [Qemu-devel] [PATCH 03/10] mirror: Fix permissions for removing mirror_top_bs Eric Blake
2017-03-06 16:21 ` [Qemu-devel] [PATCH 04/10] mirror: Fix error path for dirty bitmap creation Kevin Wolf
2017-03-06 20:15   ` Eric Blake
2017-03-06 16:21 ` [Qemu-devel] [PATCH 05/10] block: Fix blockdev-snapshot error handling Kevin Wolf
2017-03-06 20:23   ` Eric Blake
2017-03-07 12:32     ` Kevin Wolf
2017-03-06 16:21 ` [Qemu-devel] [PATCH 06/10] block: Factor out should_update_child() Kevin Wolf
2017-03-06 20:35   ` Eric Blake
2017-03-07  0:00     ` Philippe Mathieu-Daudé
2017-03-06 16:21 ` [Qemu-devel] [PATCH 07/10] block: Factor out bdrv_replace_child_noperm() Kevin Wolf
2017-03-06 20:36   ` Eric Blake
2017-03-06 16:22 ` [Qemu-devel] [PATCH 08/10] block: Ignore multiple children in bdrv_check_update_perm() Kevin Wolf
2017-03-06 21:07   ` Eric Blake
2017-03-06 16:22 ` [Qemu-devel] [PATCH 09/10] block: Handle permission errors in change_parent_backing_link() Kevin Wolf
2017-03-06 21:19   ` Eric Blake
2017-03-06 16:22 ` [Qemu-devel] [PATCH 10/10] block: Fix error handling in bdrv_replace_in_backing_chain() Kevin Wolf
2017-03-06 21:22   ` Eric Blake
2017-03-07  9:06 ` [Qemu-devel] [PATCH 00/10] block: Op blocker fixes Fam Zheng
2017-03-07 12:36 ` 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=1488817322-11397-4-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=mreitz@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).