qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qcow2: Invalidate cache after failed read
@ 2010-10-28 14:23 Kevin Wolf
  2010-10-28 15:00 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wolf @ 2010-10-28 14:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

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

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qcow2-cluster.c  |    1 +
 block/qcow2-refcount.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 4f7dc59..b040208 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 0efb676..a10453c 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;
     }
 
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] qcow2: Invalidate cache after failed read
  2010-10-28 14:23 [Qemu-devel] [PATCH] qcow2: Invalidate cache after failed read Kevin Wolf
@ 2010-10-28 15:00 ` Stefan Hajnoczi
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2010-10-28 15:00 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

On Thu, Oct 28, 2010 at 3:23 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> The cache content may be destroyed after a failed read, better not use it any
> more.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/qcow2-cluster.c  |    1 +
>  block/qcow2-refcount.c |    1 +
>  2 files changed, 2 insertions(+), 0 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-28 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-28 14:23 [Qemu-devel] [PATCH] qcow2: Invalidate cache after failed read Kevin Wolf
2010-10-28 15:00 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).