diff options
author | Kevin Wolf <kwolf@redhat.com> | 2018-07-06 18:41:07 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-07-10 10:36:15 +0200 |
commit | b0ddcbbb36a66a605eb232b905cb49b1cc72e74e (patch) | |
tree | 17559d6ee3a6ea34daf7bd50a8174a54d90a4b30 /tests/qemu-iotests/197.out | |
parent | b994c5bc515fe611885113e7cfa7e87817bfd4e2 (diff) |
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>
Diffstat (limited to 'tests/qemu-iotests/197.out')
-rw-r--r-- | tests/qemu-iotests/197.out | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/qemu-iotests/197.out b/tests/qemu-iotests/197.out index 52b4137d7b..8febda5dea 100644 --- a/tests/qemu-iotests/197.out +++ b/tests/qemu-iotests/197.out @@ -23,4 +23,12 @@ can't open device TEST_DIR/t.wrap.qcow2: Can't use copy-on-read on read-only dev 1023.938 MiB (0x3fff0000) bytes not allocated at offset 3 GiB (0xc0010000) No errors were found on the image. Images are identical. + +=== Partial final cluster === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024 +read 1024/1024 bytes at offset 0 +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +1 KiB (0x400) bytes allocated at offset 0 bytes (0x0) +No errors were found on the image. *** done |