]> git.ipfire.org Git - thirdparty/qemu.git/commit
qcow2: Fix copy_sectors() with VM state
authorKevin Wolf <kwolf@redhat.com>
Wed, 26 Mar 2014 12:06:03 +0000 (13:06 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 3 Jul 2014 21:18:14 +0000 (16:18 -0500)
commit641c3ec44252f077100269e631a3583046848f18
tree080913c443d960d8b7c6a955536bda5abab4e272
parentc2c52728f5719a4534f52fd2f0c6f3d04e230bdf
qcow2: Fix copy_sectors() with VM state

bs->total_sectors is not the highest possible sector number that could
be involved in a copy on write operation: VM state is after the end of
the virtual disk. This resulted in wrong values for the number of
sectors to be copied (n).

The code that checks for the end of the image isn't required any more
because the code hasn't been calling the block layer's bdrv_read() for a
long time; instead, it directly calls qcow2_readv(), which doesn't error
out on VM state sector numbers.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 6b7d4c55586a849aa8313282d79432917eade3bf)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/qcow2-cluster.c
tests/qemu-iotests/029
tests/qemu-iotests/029.out