diff options
author | Kevin Wolf <kwolf@redhat.com> | 2010-06-07 16:43:22 +0200 |
---|---|---|
committer | Doug Goldstein <cardoe@gentoo.org> | 2010-07-20 17:40:47 -0500 |
commit | 60c950b7237bb7d541183077ccf3174f3ff3e936 (patch) | |
tree | f721289ac7a3d1556b1395b8f097ec6f2f46ab80 | |
parent | block/vdi: Fix image opening and creation for odd disk sizes (diff) | |
download | qemu-kvm-60c950b7237bb7d541183077ccf3174f3ff3e936.tar.gz qemu-kvm-60c950b7237bb7d541183077ccf3174f3ff3e936.tar.bz2 qemu-kvm-60c950b7237bb7d541183077ccf3174f3ff3e936.zip |
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; } |