Bug 1834281

Summary: qemu-img convert abort when converting image with unaligned size
Product: Red Hat Enterprise Linux 8 Reporter: Xueqiang Wei <xuwei>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
qemu-kvm sub component: Storage QA Contact: Xueqiang Wei <xuwei>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: aliang, chayang, coli, ddepaula, jinzhao, juzhang, knoel, kwolf, virt-maint
Version: 8.3Keywords: Regression, Triaged
Target Milestone: rc   
Target Release: 8.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-4.2.0-44.module+el8.4.0+9776+c5744f20 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1834646 (view as bug list) Environment:
Last Closed: 2021-05-18 15:21:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1834646    
Bug Blocks:    

Description Xueqiang Wei 2020-05-11 12:59:50 UTC
Description of problem:

# qemu-img convert -f raw -O raw -p -t none -T none test.img tgt.img -o preallocation=falloc
qemu-img: block/io.c:1871: bdrv_co_write_req_prepare: Assertion `end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE' failed.
Aborted (core dumped)



Version-Release number of selected component (if applicable):

kernel-4.18.0-194.el8.x86_64
qemu-kvm-4.2.0-19.module+el8.3.0+6478+69f490bb
qemu-img-4.2.0-19.module+el8.3.0+6478+69f490bb


How reproducible:
100%

Steps to Reproduce:
1. # mount -t nfs -o soft,vers=4.2 10.66.61.132:/home/nfs_server/ /home/kvm_autotest_root/images/
2. # cd /home/kvm_autotest_root/images/
3. # truncate -s 11136 test.img
4. # qemu-io -c 'write -P 1 0 10K' test.img -f raw
5. # qemu-img convert -f raw -O raw -p -t none -T none test.img tgt.img -o preallocation=falloc


Actual results:
after step5:
# qemu-img convert -f raw -O raw -p -t none -T none test.img tgt.img -o preallocation=falloc
qemu-img: block/io.c:1871: bdrv_co_write_req_prepare: Assertion `end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE' failed.
Aborted (core dumped)

Expected results:
# qemu-img convert -f raw -O raw -p -t none -T none test.img tgt.img -o preallocation=falloc
    (100.00/100%)



Additional info:
It works well on rhel8.1.0 slow train and rhel8.1.0 fast train.
It doesn't work on rhel.2.0 slow train and rhel8.2.0 fast train.

Details:
1. according to https://bugzilla.redhat.com/show_bug.cgi?id=1678979#c19, it had been fixed on rhel8.1.0 slow train.

Tested with qemu-kvm-2.12.0-83.module+el8.1.0+3852+0ba8aef0, it works well.
# truncate -s 11136 test.img
# qemu-io -c 'write -P 1 0 10K' test.img -f raw
wrote 10240/10240 bytes at offset 0
10 KiB, 1 ops; 0.0346 sec (288.218 KiB/sec and 28.8218 ops/sec)
# qemu-img convert -f raw -O raw -p -t none -T none test.img tgt.img -o preallocation=falloc
    (100.00/100%)

2. according to https://bugzilla.redhat.com/show_bug.cgi?id=1588356#c16, it had been fixed on rhel8.1.0 fast train.

Tested with qemu-kvm-4.0.0-5.module+el8.1.0+3622+5812d9bf, it works well.
# truncate -s 11136 test.img
# qemu-io -c 'write -P 1 0 10K' test.img -f raw
wrote 10240/10240 bytes at offset 0
10 KiB, 1 ops; 0.0278 sec (359.557 KiB/sec and 35.9557 ops/sec)
# qemu-img convert -f raw -O raw -p -t none -T none test.img tgt.img -o preallocation=falloc
    (100.00/100%)

3. Tested on rhel8.2.0 slow train, it doesn't work.

Tested with qemu-kvm-2.12.0-99.module+el8.2.0+5827+8c39933c, qemu core dumped.

# truncate -s 11136 test.img
# qemu-io -c 'write -P 1 0 10K' test.img -f raw
wrote 10240/10240 bytes at offset 0
10 KiB, 1 ops; 0.0453 sec (220.386 KiB/sec and 22.0386 ops/sec)
# qemu-img convert -f raw -O raw -p -t none -T none test.img tgt.img -o preallocation=falloc
qemu-img: block/io.c:1646: bdrv_aligned_pwritev: Assertion `end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE' failed.
Aborted (core dumped)

4. Tested on rhel8.2.0 fast train, it doesn't work.

Tested with qemu-kvm-4.2.0-19.module+el8.2.0+6296+6b821950, qemu core dumped

# truncate -s 11136 test.img
# qemu-io -c 'write -P 1 0 10K' test.img -f raw
wrote 10240/10240 bytes at offset 0
10 KiB, 1 ops; 00.04 sec (236.864 KiB/sec and 23.6864 ops/sec)
# qemu-img convert -f raw -O raw -p -t none -T none test.img tgt.img -o preallocation=falloc
qemu-img: block/io.c:1871: bdrv_co_write_req_prepare: Assertion `end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE' failed.
Aborted (core dumped)

Comment 2 John Ferlan 2020-05-15 14:36:38 UTC
Adjusting dependency order - fix goes into RHEL AV first, then RHEL.

Comment 3 John Ferlan 2020-05-19 20:43:53 UTC
Assigned to Ademar for initial triage per bz process and age of bug created or assigned to virt-maint without triage.

Not sure if this would be Kevin or Max. If bug 1834646 makes it into RHEL AV 8.2.1, then this bug would pick up change when rebase occurs

Comment 12 Xueqiang Wei 2021-01-26 10:55:21 UTC
Tested it on rhel8.4 slow train, hit this issue.

Versions:
kernel-4.18.0-277.el8.x86_64
qemu-kvm-4.2.0-41.module+el8.4.0+9504+ab2393e6


steps:
1. # mkdir -p /home/kvm_autotest_root/images/
   # mount -t nfs -o soft,vers=4.2 10.66.61.132:/home/nfs_server/ /home/kvm_autotest_root/images/

2. # cd /home/kvm_autotest_root/images/

3. # truncate -s 11136 test.img

4. # qemu-io -c 'write -P 1 0 10K' test.img -f raw
wrote 10240/10240 bytes at offset 0
10 KiB, 1 ops; 00.04 sec (247.197 KiB/sec and 24.7197 ops/sec)

5. # qemu-img convert -f raw -O raw -p -t none -T none test.img tgt.img -o preallocation=falloc
qemu-img: block/io.c:1871: bdrv_co_write_req_prepare: Assertion `end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE' failed.
Aborted (core dumped)

Comment 15 Xueqiang Wei 2021-02-02 23:07:07 UTC
Tested it with qemu-kvm-4.2.0-44.module+el8.4.0+9776+c5744f20, not hit this issue.

Versions:
kernel-4.18.0-280.el8.x86_64
qemu-kvm-4.2.0-44.module+el8.4.0+9776+c5744f20


steps:
1. # mkdir -p /home/kvm_autotest_root/images/
   # mount -t nfs -o soft,vers=4.2 10.66.61.132:/home/nfs_server/ /home/kvm_autotest_root/images/

2. # cd /home/kvm_autotest_root/images/

3. # truncate -s 11136 test.img

4. # qemu-io -c 'write -P 1 0 10K' test.img -f raw
wrote 10240/10240 bytes at offset 0
10 KiB, 1 ops; 00.03 sec (293.422 KiB/sec and 29.3422 ops/sec)

5. # qemu-img convert -f raw -O raw -p -t none -T none test.img tgt.img -o preallocation=falloc
    (100.00/100%)
  # echo $?
  0

# qemu-img convert -f raw -O raw -p -t none -T none test.img tgt.img -o preallocation=full
    (100.00/100%)
# echo $?
  0

# qemu-img convert -f raw -O raw -p -t none -T none test.img tgt.img -o preallocation=off
    (100.00/100%)
# echo $?
  0

Comment 16 Xueqiang Wei 2021-02-03 16:05:50 UTC
Hi Danilo,

Shall we add this bug to errata and change it to ON_QA status? Thanks.

Comment 20 Xueqiang Wei 2021-02-04 01:52:10 UTC
According to Comment 15, set status to VERIFIED. Thanks.

Comment 22 errata-xmlrpc 2021-05-18 15:21:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: virt:rhel and virt-devel:rhel security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:1762