From dfe0bb55eea9efabc98d074407e01c9a85b7497b Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 7 Jun 2010 16:43:22 +0200 Subject: [PATCH] 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 (cherry picked from commit 68dba0bf455e60061bb3c9c40ef0d82916372664) --- block/qcow2-cluster.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index b7a5b35f40e..8c67e3c07d9 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -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; } -- 2.39.5