From: Kevin Wolf Date: Mon, 7 Jun 2010 14:43:22 +0000 (+0200) Subject: qcow2: Restore L1 entry on l2_allocate failure X-Git-Tag: v0.13.0-rc0~237 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68dba0bf455e60061bb3c9c40ef0d82916372664;p=thirdparty%2Fqemu.git 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 Signed-off-by: Kevin Wolf --- diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 03a9f257994..5760ad6d26a 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; }