]> git.proxmox.com Git - qemu.git/commitdiff
qcow2: flush in qcow2_update_snapshot_refcount()
authorStefan Hajnoczi <stefanha@redhat.com>
Mon, 4 Mar 2013 14:02:33 +0000 (15:02 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 15 Mar 2013 15:07:50 +0000 (16:07 +0100)
Users of qcow2_update_snapshot_refcount() do not flush consistently.
qcow2_snapshot_create() flushes but qcow2_snapshot_goto() and
qcow2_snapshot_delete() do not.

Solve this by moving the bdrv_flush() into
qcow2_update_snapshot_refcount().

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2-refcount.c
block/qcow2-snapshot.c

index 4d9df5fe95d891520f9a15c1103ad19cd8879b51..3d29d30f03e106aa281e86c8eef4253acf7bc236 100644 (file)
@@ -851,7 +851,7 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs,
         }
     }
 
-    ret = 0;
+    ret = bdrv_flush(bs);
 fail:
     if (l2_table) {
         qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
index f4719d9909c5ae1e35d148d24f73dc510f5b0ce9..992a5c865c26578f1c5279e1e3c80c6c18b6e21f 100644 (file)
@@ -381,11 +381,6 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
         goto fail;
     }
 
-    ret = bdrv_flush(bs);
-    if (ret < 0) {
-        goto fail;
-    }
-
     /* Append the new snapshot to the snapshot list */
     new_snapshot_list = g_malloc((s->nb_snapshots + 1) * sizeof(QCowSnapshot));
     if (s->snapshots) {