mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
block: Fix copy-on-read crash with partial final cluster
If the virtual disk size isn't aligned to full clusters, bdrv_co_do_copy_on_readv() may get pnum == 0 before having the full cluster completed, which will let it run into an assertion failure: qemu-io: block/io.c:1203: bdrv_co_do_copy_on_readv: Assertion `skip_bytes < pnum' failed. Check for EOF, assert that we read at least as much as the read request originally wanted to have (which is true at EOF because otherwise bdrv_check_byte_request() would already have returned an error) and return success early even though we couldn't copy the full cluster. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
b994c5bc51
commit
b0ddcbbb36
3 changed files with 23 additions and 0 deletions
|
@ -109,6 +109,15 @@ $QEMU_IO -f qcow2 -c map "$TEST_WRAP"
|
|||
_check_test_img
|
||||
$QEMU_IMG compare -f $IMGFMT -F qcow2 "$TEST_IMG" "$TEST_WRAP"
|
||||
|
||||
echo
|
||||
echo '=== Partial final cluster ==='
|
||||
echo
|
||||
|
||||
_make_test_img 1024
|
||||
$QEMU_IO -f $IMGFMT -C -c 'read 0 1024' "$TEST_IMG" | _filter_qemu_io
|
||||
$QEMU_IO -f $IMGFMT -c map "$TEST_IMG"
|
||||
_check_test_img
|
||||
|
||||
# success, all done
|
||||
echo '*** done'
|
||||
status=0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue