The BDRV_O_SNAPSHOT flag is stored in open_flags but not passed to
bdrv_open.  This makes the usage of bs->open_flags wrong in
bdrv_snapshot_goto.

(Instead, bdrv_commit uses the backing file's open_flags and those
flags never include any of BDRV_O_SNAPSHOT, BDRV_O_NO_BACKING
or BDRV_O_RDWR).

We will fix the open_flags soon.  In the meanwhile, do not rely
on open_flags including BDRV_O_SNAPSHOT.

Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
 block.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block.c b/block.c
index 56c7981..a96f080 100644
--- a/block.c
+++ b/block.c
@@ -2463,7 +2463,7 @@ int bdrv_can_snapshot(BlockDriverState *bs)
 
 int bdrv_is_snapshot(BlockDriverState *bs)
 {
-    return !!(bs->open_flags & BDRV_O_SNAPSHOT);
+    return bs->is_temporary;
 }
 
 BlockDriverState *bdrv_snapshots(void)
-- 
1.7.7.1



Reply via email to