From: Kevin Wolf Date: Thu, 28 Oct 2010 14:16:00 +0000 (+0200) Subject: qcow2: Invalidate cache after failed read X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1c02e2a17104fe7fc11893125864dc0daf1e6d5b;p=qmiga%2Fqemu.git qcow2: Invalidate cache after failed read The cache content may be destroyed after a failed read, better not use it any more. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 4f7dc59b76..b0402087cf 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -188,6 +188,7 @@ static int l2_load(BlockDriverState *bs, uint64_t l2_offset, ret = bdrv_pread(bs->file, l2_offset, *l2_table, s->l2_size * sizeof(uint64_t)); if (ret < 0) { + qcow2_l2_cache_reset(bs); return ret; } diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 0efb6760cb..a10453c875 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -103,6 +103,7 @@ static int load_refcount_block(BlockDriverState *bs, ret = bdrv_pread(bs->file, refcount_block_offset, s->refcount_block_cache, s->cluster_size); if (ret < 0) { + s->refcount_block_cache_offset = 0; return ret; }