[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 13/14] qcow2: Fix corruption after error in update_r
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 13/14] qcow2: Fix corruption after error in update_refcount |
Date: |
Fri, 28 May 2010 18:46:12 +0200 |
After it is done with updating refcounts in the cache, update_refcount writes
all changed entries to disk. If a refcount block allocation fails, however,
there was no change yet and therefore first_index = last_index = -1. Don't
treat -1 as a normal sector index (resulting in a 512 byte write!) but return
without updating anything in this case.
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2-refcount.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 5b7cda4..22b0b45 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -417,6 +417,10 @@ static int write_refcount_block_entries(BlockDriverState
*bs,
return 0;
}
+ if (first_index < 0) {
+ return 0;
+ }
+
first_index &= ~(REFCOUNTS_PER_SECTOR - 1);
last_index = (last_index + REFCOUNTS_PER_SECTOR)
& ~(REFCOUNTS_PER_SECTOR - 1);
--
1.6.6.1
- [Qemu-devel] [PATCH 03/14] block: Fix multiwrite with overlapping requests, (continued)
- [Qemu-devel] [PATCH 03/14] block: Fix multiwrite with overlapping requests, Kevin Wolf, 2010/05/28
- [Qemu-devel] [PATCH 04/14] qemu-io: Add multiwrite command, Kevin Wolf, 2010/05/28
- [Qemu-devel] [PATCH 05/14] add support for protocol driver create_options, Kevin Wolf, 2010/05/28
- [Qemu-devel] [PATCH 06/14] drive: allow rerror, werror and readonly for if=none, Kevin Wolf, 2010/05/28
- [Qemu-devel] [PATCH 07/14] posix-aio-compat: Expand tabs that have crept in, Kevin Wolf, 2010/05/28
- [Qemu-devel] [PATCH 08/14] block.h: Make BDRV_SECTOR_SIZE 64 bit safe, Kevin Wolf, 2010/05/28
- [Qemu-devel] [PATCH 09/14] qcow2: Allow qcow2_get_cluster_offset to return errors, Kevin Wolf, 2010/05/28
- [Qemu-devel] [PATCH 10/14] qcow2: Change l2_load to return 0/-errno, Kevin Wolf, 2010/05/28
- [Qemu-devel] [PATCH 11/14] qcow2: Return right error code in write_refcount_block_entries, Kevin Wolf, 2010/05/28
- [Qemu-devel] [PATCH 12/14] qcow2: Fix corruption after refblock allocation, Kevin Wolf, 2010/05/28
- [Qemu-devel] [PATCH 13/14] qcow2: Fix corruption after error in update_refcount,
Kevin Wolf <=
- [Qemu-devel] [PATCH 14/14] block: Add missing bdrv_delete() for SG_IO BlockDriver in find_image_format(), Kevin Wolf, 2010/05/28
- [Qemu-devel] Re: [PULL 00/14] Block patches, Anthony Liguori, 2010/05/28