qemu-e2k/block
Gerhard Wiesinger b1649fae49 vmdk: Fix data corruption bug in WRITE and READ handling
Fixed a MAJOR BUG in VMDK files on file boundaries on reads
and ALSO ON WRITES WHICH MIGHT CORRUPT THE IMAGE AND DATA!!!!!!

Triggered for example with the following VMDK file (partly listed):
RW 4193792 FLAT "XP-W1-f001.vmdk" 0
RW 2097664 FLAT "XP-W1-f002.vmdk" 0
RW 4193792 FLAT "XP-W1-f003.vmdk" 0
RW 512 FLAT "XP-W1-f004.vmdk" 0
RW 4193792 FLAT "XP-W1-f005.vmdk" 0
RW 2097664 FLAT "XP-W1-f006.vmdk" 0
RW 4193792 FLAT "XP-W1-f007.vmdk" 0
RW 512 FLAT "XP-W1-f008.vmdk" 0

Patch includes:
1.) Patch fixes wrong calculation on extent boundaries. Especially it
fixes the relativeness of the sector number to the current extent.

Verfied correctness with:
1.) Converted either with Virtualbox to VDI and then with qemu-img and
    then with qemu-img only:

    VBoxManage clonehd --format vdi /VM/XP-W/new/XP-W1.vmdk ~/.VirtualBox/Harddisks/XP-W1-new-test.vdi
    ./qemu-img convert -O raw ~/.VirtualBox/Harddisks/XP-W1-new-test.vdi /root/QEMU/VM-XP-W1/XP-W1-via-VBOX.img
    md5sum /root/QEMU/VM-XP-W/XP-W1-direct.img
    md5sum /root/QEMU/VM-XP-W/XP-W1-via-VBOX.img
    => same MD5 hash

2.) Verified debug log files
3.) Run Windows XP successfully
4.) chkdsk run successfully without any errors

Signed-off-by: Gerhard Wiesinger <lists@wiesinger.com>
Acked-by: Fam Zheng <famcool@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-11-14 18:19:23 +01:00
..
Makefile.objs Merge remote-tracking branch 'origin/master' into threadpool 2012-10-31 10:42:51 +01:00
blkdebug.c aio: rename AIOPool to AIOCBInfo 2012-11-14 18:19:21 +01:00
blkverify.c aio: rename AIOPool to AIOCBInfo 2012-11-14 18:19:21 +01:00
bochs.c block: take lock around bdrv_read implementations 2011-10-21 17:34:14 +02:00
cloop.c block/cloop: Use g_free instead of free 2011-11-04 14:24:12 +01:00
commit.c block: rename block_job_complete to block_job_completed 2012-10-24 10:26:19 +02:00
cow.c block: Fix spelling in comment (ineffcient -> inefficient) 2012-04-19 15:48:52 +02:00
curl.c aio: rename AIOPool to AIOCBInfo 2012-11-14 18:19:21 +01:00
dmg.c block: take lock around bdrv_read implementations 2011-10-21 17:34:14 +02:00
gluster.c aio: rename AIOPool to AIOCBInfo 2012-11-14 18:19:21 +01:00
iscsi.c aio: rename AIOPool to AIOCBInfo 2012-11-14 18:19:21 +01:00
linux-aio.c aio: rename AIOPool to AIOCBInfo 2012-11-14 18:19:21 +01:00
mirror.c mirror: add support for on-source-error/on-target-error 2012-10-24 10:26:22 +02:00
nbd.c nbd: accept URIs 2012-11-12 14:38:28 +01:00
parallels.c block: take lock around bdrv_read implementations 2011-10-21 17:34:14 +02:00
qcow.c block: qcow image file reopen 2012-09-24 15:15:12 +02:00
qcow2-cache.c qcow2: always operate caches in writeback mode 2012-06-15 14:03:43 +02:00
qcow2-cluster.c qcow2: implement lazy refcounts 2012-08-06 22:39:14 +02:00
qcow2-refcount.c qcow2: Fix refcount table size calculation 2012-11-14 18:19:21 +01:00
qcow2-snapshot.c qcow2: fix #ifdef'd qcow2_check_refcounts() callers 2012-07-09 15:53:01 +02:00
qcow2.c qcow2: mark this file's sole strncpy use as justified 2012-10-05 07:58:38 -05:00
qcow2.h qcow2: implement lazy refcounts 2012-08-06 22:39:14 +02:00
qed-check.c qed: mark image clean after repair succeeds 2012-08-10 10:25:12 +02:00
qed-cluster.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-gencb.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-l2-cache.c qed: do not evict in-use L2 table cache entries 2012-03-12 15:14:06 +01:00
qed-table.c cleanup useless return sentence 2012-10-05 15:10:21 +02:00
qed.c aio: rename AIOPool to AIOCBInfo 2012-11-14 18:19:21 +01:00
qed.h qed: mark image clean after repair succeeds 2012-08-10 10:25:12 +02:00
raw-aio.h raw-win32: implement native asynchronous I/O 2012-10-31 10:38:13 +01:00
raw-posix.c raw-posix: rename raw-posix-aio.h, hide unavailable prototypes 2012-10-31 10:38:12 +01:00
raw-win32.c raw-win32: implement native asynchronous I/O 2012-10-31 10:38:13 +01:00
raw.c block: raw image file reopen 2012-09-24 15:15:12 +02:00
rbd.c aio: rename AIOPool to AIOCBInfo 2012-11-14 18:19:21 +01:00
sheepdog.c aio: rename AIOPool to AIOCBInfo 2012-11-14 18:19:21 +01:00
stream.c block: rename block_job_complete to block_job_completed 2012-10-24 10:26:19 +02:00
vdi.c block: vdi image file reopen 2012-09-24 15:15:12 +02:00
vmdk.c vmdk: Fix data corruption bug in WRITE and READ handling 2012-11-14 18:19:23 +01:00
vpc.c block: vpc image file reopen 2012-09-24 15:15:12 +02:00
vvfat.c block: Convert close calls to qemu_close 2012-08-15 10:48:57 +02:00
win32-aio.c aio: rename AIOPool to AIOCBInfo 2012-11-14 18:19:21 +01:00