block: Fix open_flags in bdrv_reopen()
authorKevin Wolf <kwolf@redhat.com>
Fri, 25 Apr 2014 17:04:55 +0000 (19:04 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 30 Apr 2014 09:05:00 +0000 (11:05 +0200)
Use the same function as bdrv_open() for determining what the right
flags for bs->file are. Without doing this, a reopen means that
bs->file loses BDRV_O_CACHE_WB or BDRV_O_UNMAP if bs doesn't have it as
well.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
block.c

diff --git a/block.c b/block.c
index 9f6f07e..b749d31 100644 (file)
--- a/block.c
+++ b/block.c
@@ -1525,8 +1525,11 @@ BlockReopenQueue *bdrv_reopen_queue(BlockReopenQueue *bs_queue,
         QSIMPLEQ_INIT(bs_queue);
     }
 
+    /* bdrv_open() masks this flag out */
+    flags &= ~BDRV_O_PROTOCOL;
+
     if (bs->file) {
-        bdrv_reopen_queue(bs_queue, bs->file, flags);
+        bdrv_reopen_queue(bs_queue, bs->file, bdrv_inherited_flags(flags));
     }
 
     bs_entry = g_new0(BlockReopenQueueEntry, 1);