block: Set BDRV_O_ALLOW_RDWR during rw reopen
authorKevin Wolf <kwolf@redhat.com>
Thu, 3 Aug 2017 15:02:59 +0000 (17:02 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 8 Aug 2017 13:19:16 +0000 (15:19 +0200)
Reopening an image should be consistent with opening it, so we should
set BDRV_O_ALLOW_RDWR for any image that is reopened read-write like in
bdrv_open_inherit().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
block.c

diff --git a/block.c b/block.c
index 2711c3dd3b7b9d05c6bc9f70f3b37ea3aef954ae..3615a6809e81583ea9508297b6d8c41527707878 100644 (file)
--- a/block.c
+++ b/block.c
@@ -2729,8 +2729,11 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
     bdrv_join_options(bs, options, old_options);
     QDECREF(old_options);
 
-    /* bdrv_open() masks this flag out */
+    /* bdrv_open_inherit() sets and clears some additional flags internally */
     flags &= ~BDRV_O_PROTOCOL;
+    if (flags & BDRV_O_RDWR) {
+        flags |= BDRV_O_ALLOW_RDWR;
+    }
 
     QLIST_FOREACH(child, &bs->children, next) {
         QDict *new_child_options;