Patchwork [01/17] block: do not rely on open_flags for bdrv_is_snapshot

login
register
mail settings
Submitter Paolo Bonzini
Date Dec. 13, 2011, 12:37 p.m.
Message ID <1323779840-4235-2-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/131064/
State New
Headers show

Comments

Paolo Bonzini - Dec. 13, 2011, 12:37 p.m.
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 <pbonzini@redhat.com>
---
 block.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

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)