+++ This bug was initially created as a clone of Bug #1196688 +++
Description of problem:
bdrv_make_zero() clamps the nb_sectors value:
if (nb_sectors > INT_MAX) {
nb_sectors = INT_MAX;
}
But INT_MAX is too large because bdrv_rw_co() performs the following check later:
if (nb_sectors < 0 || nb_sectors > INT_MAX / BDRV_SECTOR_SIZE) {
return -EINVAL;
}
Fam Zheng already fixed this bug upstream so we just need to backport the fix:
http://git.qemu-project.org/?p=qemu.git;a=commitdiff;h=f3a9cfddaec127078ac1898de6b063db8ac3bb48
How reproducible:
Deterministic
Steps to Reproduce:
1. qemu-img create input.img 2G
2. qemu-img create output.img 2G
3. sudo losetup -f output.img
4. qemu-img convert -t none -O raw input.img /dev/loop0
Actual results:
qemu-img: error writing zeroes at sector 0: Invalid argument
Expected results:
Success from qemu-img convert.
--- Additional comment from Stefan Hajnoczi on 2015-02-27 07:18:16 EST ---
--- Additional comment from Stefan Hajnoczi on 2015-03-06 17:35:37 EST ---
Set state to modified. The patch will come into RHEL 7.2 qemu-kvm from upstream via rebase.
--- Additional comment from Dan Prince on 2015-03-09 08:37:31 EDT ---
This same issue effects Fedora 21 as well and is displayed when trying to use OpenStack Cinder to convert Glance images. Could we backport the fix into Fedora 21 as well (it is preventing upstream CI from using Fedora ATM).