Sophie

Sophie

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

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

From 6dfc2a9bfb5bbd7f5f2ba4249e90eebee896e6b2 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Fri, 18 Jun 2010 15:22:29 -0300
Subject: [PATCH 11/18] qcow2: Clear L2 table cache after write error

RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <patch-9986-clone-for-rhel55-rhel55>
Patchwork-id: 10044
O-Subject: [RHEL-5.6 KVM PATCH 11/16] qcow2: Clear L2 table cache after write
	error
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: 1b7c801b40ce90795397bb566d019c9b76ef9c13

If the L2 table was already updated in cache, but writing it to disk has
failed, we must not continue using the changed version in the cache to stay
consistent with what's on the disk.

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 5274f12..ef0e26b 100644
--- a/qemu/block-qcow2.c
+++ b/qemu/block-qcow2.c
@@ -1113,6 +1113,7 @@ static int alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m)
 
     ret = write_l2_entries(s, l2_table, l2_offset, l2_index, m->nb_clusters);
     if (ret < 0) {
+        l2_cache_reset(bs);
         goto err;
     }
 
-- 
1.7.0.3