diff options
author | Kevin Wolf <kwolf@redhat.com> | 2010-06-07 16:43:22 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2010-07-14 11:55:31 +0200 |
commit | dfe0bb55eea9efabc98d074407e01c9a85b7497b (patch) | |
tree | 2977a1df2c608f326f3ad8bac78591c875a634f8 | |
parent | 6fd82592cec15256a6dcfe516a7ce6c99f1912b7 (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>
(cherry picked from commit 68dba0bf455e60061bb3c9c40ef0d82916372664)
-rw-r--r-- | block/qcow2-cluster.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index b7a5b35f4..8c67e3c07 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; } |