Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 3160499aacb81f6735941eb4c372d87a > files > 537

kvm-83-164.el5_5.30.src.rpm

From c65e634f0f032e8f9d742afa25b269aa0d024b4b Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Fri, 18 Jun 2010 15:22:31 -0300
Subject: [PATCH 13/18] qcow2: Restore L1 entry on l2_allocate failure

RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <patch-9988-clone-for-rhel55-rhel55>
Patchwork-id: 10046
O-Subject: [RHEL-5.6 KVM PATCH 13/16] qcow2: Restore L1 entry on l2_allocate
	failure
Bugzilla: 612508
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Christoph Hellwig <chellwig@redhat.com>
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>

Bugzilla: 605701
Upstream commit: 68dba0bf455e60061bb3c9c40ef0d82916372664

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>
---
 qemu/block-qcow2.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qemu/block-qcow2.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/qemu/block-qcow2.c b/qemu/block-qcow2.c
index 208af96..9291a2a 100644
--- a/qemu/block-qcow2.c
+++ b/qemu/block-qcow2.c
@@ -754,6 +754,7 @@ static int l2_allocate(BlockDriverState *bs, int l1_index, uint64_t **table)
     return 0;
 
 fail:
+    s->l1_table[l1_index] = old_l2_offset;
     l2_cache_reset(bs);
     return ret;
 }
-- 
1.7.0.3