Skip to contentSkip to conversation

qcow2: Invalidate cache after failed read

PATCH In review Kevin Wolf 2 participants 2 messages Oct 28, 2010 Block layer

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 qcow2: Invalidate cache after failed read

The cache content may be destroyed after a failed read, better not use it any more.

---
 block/qcow2-cluster.c  |    1 +
 block/qcow2-refcount.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
block/qcow2-cluster.c +1 -0
index 4f7dc59..b040208 100644
@@ -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;
     }
 
block/qcow2-refcount.c +1 -0
index 0efb676..a10453c 100644
@@ -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;
     }
 
Signature · 1 line
1.7.2.3