All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH for-2.10 1/5] block: Fix order in bdrv_replace_child()
Date: Thu,  3 Aug 2017 17:02:57 +0200	[thread overview]
Message-ID: <20170803150301.10177-2-kwolf@redhat.com> (raw)
In-Reply-To: <20170803150301.10177-1-kwolf@redhat.com>

Commit 8ee03995 refactored the code incorrectly and broke the release of
permissions on the old BDS. Instead of changing the permissions to the
new required values after removing the old BDS from the list of
children, it only re-obtains the permissions it already had.

Change the order of operations so that the old BDS is removed again
before calculating the new required permissions.

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

diff --git a/block.c b/block.c
index ce9cce7b3c..ab908cdc50 100644
--- a/block.c
+++ b/block.c
@@ -1933,6 +1933,8 @@ static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs)
     BlockDriverState *old_bs = child->bs;
     uint64_t perm, shared_perm;
 
+    bdrv_replace_child_noperm(child, new_bs);
+
     if (old_bs) {
         /* Update permissions for old node. This is guaranteed to succeed
          * because we're just taking a parent away, so we're loosening
@@ -1942,8 +1944,6 @@ static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs)
         bdrv_set_perm(old_bs, perm, shared_perm);
     }
 
-    bdrv_replace_child_noperm(child, new_bs);
-
     if (new_bs) {
         bdrv_get_cumulative_perm(new_bs, &perm, &shared_perm);
         bdrv_set_perm(new_bs, perm, shared_perm);
-- 
2.13.3

  reply	other threads:[~2017-08-03 15:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-03 15:02 [Qemu-devel] [PATCH for-2.10 0/5] block: bdrv_reopen() fixes Kevin Wolf
2017-08-03 15:02 ` Kevin Wolf [this message]
2017-08-03 15:12   ` [Qemu-devel] [PATCH for-2.10 1/5] block: Fix order in bdrv_replace_child() Eric Blake
2017-08-03 16:18   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-08-03 15:02 ` [Qemu-devel] [PATCH for-2.10 2/5] block: Allow reopen rw without BDRV_O_ALLOW_RDWR Kevin Wolf
2017-08-03 15:21   ` Eric Blake
2017-08-04  1:49     ` Eric Blake
2017-08-04 10:20       ` Kevin Wolf
2017-08-04 11:17         ` Eric Blake
2017-08-03 16:22   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-08-03 15:02 ` [Qemu-devel] [PATCH for-2.10 3/5] block: Set BDRV_O_ALLOW_RDWR during rw reopen Kevin Wolf
2017-08-03 15:27   ` Eric Blake
2017-08-03 16:24   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-08-03 15:03 ` [Qemu-devel] [PATCH for-2.10 4/5] qemu-io: Allow reopen read-write Kevin Wolf
2017-08-03 15:37   ` Eric Blake
2017-08-03 16:25   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-08-03 15:03 ` [Qemu-devel] [PATCH for-2.10 5/5] qemu-iotests: Test reopen between read-only and read-write Kevin Wolf
2017-08-03 15:41   ` Eric Blake
2017-08-03 16:28   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-08-07 23:39 ` [Qemu-devel] [Qemu-block] [PATCH for-2.10 0/5] block: bdrv_reopen() fixes John Snow
2017-08-08  7:37 ` [Qemu-devel] " 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=20170803150301.10177-2-kwolf@redhat.com \
    --to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.