summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-08-03 17:02:59 +0200
committerKevin Wolf <kwolf@redhat.com>2017-08-08 15:19:16 +0200
commitfd4520212bd4fc9c86db4ccd4d9c3d612e8e58f9 (patch)
treea51eb26f6950bb99f31a58048be3fb943526fb72 /block.c
parent54a32bfec140e03ebb19863db944b1c81e4df25e (diff)
downloadqemu-fd4520212bd4fc9c86db4ccd4d9c3d612e8e58f9.tar.gz
block: Set BDRV_O_ALLOW_RDWR during rw reopen
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>
Diffstat (limited to 'block.c')
-rw-r--r--block.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/block.c b/block.c
index 2711c3dd3b..3615a6809e 100644
--- 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;