From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=36231 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OF73f-0006ly-SS for qemu-devel@nongnu.org; Thu, 20 May 2010 10:49:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OF73Z-0007F3-3S for qemu-devel@nongnu.org; Thu, 20 May 2010 10:49:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56853) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OF73Y-0007En-SZ for qemu-devel@nongnu.org; Thu, 20 May 2010 10:49:05 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4KEn3lC001176 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 20 May 2010 10:49:03 -0400 From: Kevin Wolf Date: Thu, 20 May 2010 16:48:42 +0200 Message-Id: <1274366923-30095-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] qcow2: Clear L2 table cache after write error List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com 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 --- 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 c11680d..ed5c4b2 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -696,6 +696,7 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m) ret = write_l2_entries(bs, l2_table, l2_offset, l2_index, m->nb_clusters); if (ret < 0) { + qcow2_l2_cache_reset(bs); goto err; } -- 1.6.6.1