Blame SOURCES/kvm-block-reopen-Queue-children-after-their-parents.patch

9bac43
From 32f7f67152cf7ffe36917a2c436eb89871dcee92 Mon Sep 17 00:00:00 2001
9bac43
From: Kevin Wolf <kwolf@redhat.com>
9bac43
Date: Mon, 4 Dec 2017 12:10:04 +0100
9bac43
Subject: [PATCH 33/36] block: reopen: Queue children after their parents
9bac43
9bac43
RH-Author: Kevin Wolf <kwolf@redhat.com>
9bac43
Message-id: <20171204121007.12964-6-kwolf@redhat.com>
9bac43
Patchwork-id: 78107
9bac43
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH v2 5/8] block: reopen: Queue children after their parents
9bac43
Bugzilla: 1492178
9bac43
RH-Acked-by: Fam Zheng <famz@redhat.com>
9bac43
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9bac43
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9bac43
9bac43
We will calculate the required new permissions in the prepare stage of a
9bac43
reopen. Required permissions of children can be influenced by the
9bac43
changes made to their parents, but parents are independent from their
9bac43
children. This means that permissions need to be calculated top-down. In
9bac43
order to achieve this, queue parents before their children rather than
9bac43
queuing the children first.
9bac43
9bac43
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9bac43
Reviewed-by: Eric Blake <eblake@redhat.com>
9bac43
(cherry picked from commit 1857c97b76af02537b954c86dab066503950a4fd)
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 block.c | 26 +++++++++++++-------------
9bac43
 1 file changed, 13 insertions(+), 13 deletions(-)
9bac43
9bac43
diff --git a/block.c b/block.c
9bac43
index 5cce274..0a7e2c6 100644
9bac43
--- a/block.c
9bac43
+++ b/block.c
9bac43
@@ -2767,6 +2767,19 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
9bac43
         flags |= BDRV_O_ALLOW_RDWR;
9bac43
     }
9bac43
 
9bac43
+    if (!bs_entry) {
9bac43
+        bs_entry = g_new0(BlockReopenQueueEntry, 1);
9bac43
+        QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry);
9bac43
+    } else {
9bac43
+        QDECREF(bs_entry->state.options);
9bac43
+        QDECREF(bs_entry->state.explicit_options);
9bac43
+    }
9bac43
+
9bac43
+    bs_entry->state.bs = bs;
9bac43
+    bs_entry->state.options = options;
9bac43
+    bs_entry->state.explicit_options = explicit_options;
9bac43
+    bs_entry->state.flags = flags;
9bac43
+
9bac43
     QLIST_FOREACH(child, &bs->children, next) {
9bac43
         QDict *new_child_options;
9bac43
         char *child_key_dot;
9bac43
@@ -2786,19 +2799,6 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
9bac43
                                 child->role, options, flags);
9bac43
     }
9bac43
 
9bac43
-    if (!bs_entry) {
9bac43
-        bs_entry = g_new0(BlockReopenQueueEntry, 1);
9bac43
-        QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry);
9bac43
-    } else {
9bac43
-        QDECREF(bs_entry->state.options);
9bac43
-        QDECREF(bs_entry->state.explicit_options);
9bac43
-    }
9bac43
-
9bac43
-    bs_entry->state.bs = bs;
9bac43
-    bs_entry->state.options = options;
9bac43
-    bs_entry->state.explicit_options = explicit_options;
9bac43
-    bs_entry->state.flags = flags;
9bac43
-
9bac43
     return bs_queue;
9bac43
 }
9bac43
 
9bac43
-- 
9bac43
1.8.3.1
9bac43