Blame SOURCES/kvm-block-Fix-flags-in-reopen-queue.patch

a94a18
From bf0e9a6374d872bde330fb3c4994697250ef235b Mon Sep 17 00:00:00 2001
a94a18
From: Fam Zheng <famz@redhat.com>
a94a18
Date: Tue, 13 Mar 2018 15:27:54 +0100
a94a18
Subject: [PATCH 1/4] block: Fix flags in reopen queue
a94a18
a94a18
RH-Author: Fam Zheng <famz@redhat.com>
a94a18
Message-id: <20180313152755.31475-2-famz@redhat.com>
a94a18
Patchwork-id: 79273
a94a18
O-Subject: [RHV7.5 qemu-kvm-ma PATCH v4 1/2] block: Fix flags in reopen queue
a94a18
Bugzilla: 1557206
a94a18
RH-Acked-by: Max Reitz <mreitz@redhat.com>
a94a18
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
a94a18
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
a94a18
a94a18
Reopen flags are not synchronized according to the
a94a18
bdrv_reopen_queue_child precedence until bdrv_reopen_prepare. It is a
a94a18
bit too late: we already check the consistency in bdrv_check_perm before
a94a18
that.
a94a18
a94a18
This fixes the bug that when bdrv_reopen a RO node as RW, the flags for
a94a18
backing child are wrong. Before, we could recurse with flags.rw=1; now,
a94a18
role->inherit_options + update_flags_from_options will make sure to
a94a18
clear the bit when necessary.  Note that this will not clear an
a94a18
explicitly set bit, as in the case of parallel block jobs (e.g.
a94a18
test_stream_parallel in 030), because the explicit options include
a94a18
'read-only=false' (for an intermediate node used by a different job).
a94a18
a94a18
Signed-off-by: Fam Zheng <famz@redhat.com>
a94a18
Reviewed-by: Max Reitz <mreitz@redhat.com>
a94a18
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
a94a18
Signed-off-by: Fam Zheng <famz@redhat.com>
a94a18
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
a94a18
---
a94a18
 block.c | 8 ++++++++
a94a18
 1 file changed, 8 insertions(+)
a94a18
a94a18
diff --git a/block.c b/block.c
a94a18
index ca8a46b..a1084e7 100644
a94a18
--- a/block.c
a94a18
+++ b/block.c
a94a18
@@ -2759,8 +2759,16 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
a94a18
 
a94a18
     /* Inherit from parent node */
a94a18
     if (parent_options) {
a94a18
+        QemuOpts *opts;
a94a18
+        QDict *options_copy;
a94a18
         assert(!flags);
a94a18
         role->inherit_options(&flags, options, parent_flags, parent_options);
a94a18
+        options_copy = qdict_clone_shallow(options);
a94a18
+        opts = qemu_opts_create(&bdrv_runtime_opts, NULL, 0, &error_abort);
a94a18
+        qemu_opts_absorb_qdict(opts, options_copy, NULL);
a94a18
+        update_flags_from_options(&flags, opts);
a94a18
+        qemu_opts_del(opts);
a94a18
+        QDECREF(options_copy);
a94a18
     }
a94a18
 
a94a18
     /* Old values are used for options that aren't set yet */
a94a18
-- 
a94a18
1.8.3.1
a94a18