]> git.proxmox.com Git - qemu.git/commitdiff
qcow2: Restore L1 entry on l2_allocate failure
authorKevin Wolf <kwolf@redhat.com>
Mon, 7 Jun 2010 14:43:22 +0000 (16:43 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 14 Jul 2010 09:55:31 +0000 (11:55 +0200)
If writing the L1 table to disk failed, we need to restore its old content in
memory to avoid inconsistencies.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 68dba0bf455e60061bb3c9c40ef0d82916372664)

block/qcow2-cluster.c

index b7a5b35f40eca04773f2cb8e4b7b147b4c76c926..8c67e3c07d9995d2aface1b8f3c2a3fcb96fdf29 100644 (file)
@@ -266,6 +266,7 @@ static uint64_t *l2_allocate(BlockDriverState *bs, int l1_index)
     return l2_table;
 
 fail:
+    s->l1_table[l1_index] = old_l2_offset;
     qcow2_l2_cache_reset(bs);
     return NULL;
 }