aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-06-07 16:43:22 +0200
committerKevin Wolf <kwolf@redhat.com>2010-06-15 09:41:58 +0200
commit68dba0bf455e60061bb3c9c40ef0d82916372664 (patch)
tree85b6ee4a42bf2a574823c325a48e6a6f743d111a /block
parentdd5b0d71d660a4e31bdf8bd0d130ce582833db9f (diff)
qcow2: Restore L1 entry on l2_allocate failure
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>
Diffstat (limited to 'block')
-rw-r--r--block/qcow2-cluster.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 03a9f25799..5760ad6d26 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -285,6 +285,7 @@ static int l2_allocate(BlockDriverState *bs, int l1_index, uint64_t **table)
return 0;
fail:
+ s->l1_table[l1_index] = old_l2_offset;
qcow2_l2_cache_reset(bs);
return ret;
}