Bug 1049176

Summary: qemu-img core dump when using "-o preallocation=metadata,cluster_size=2048k" to create image of libiscsi lun
Product: Red Hat Enterprise Linux 7 Reporter: huiqingding <huding>
Component: qemu-kvmAssignee: Hanna Reitz <hreitz>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, hhuang, huding, juzhang, mazhang, mrezanin, sluo, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-49.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 10:02:39 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:

Description huiqingding 2014-01-07 07:25:27 UTC
Description of problem:
qemu-img core dump when create a image of libiscsi lun: "qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=2048k iscsi://10.66.4.204:3260/iqn.2014-01.com.example:juli/6 30G"

Version-Release number of selected component (if applicable):
kernel-3.10.0-64.el7.x86_64
qemu-img-1.5.3-31.el7.x86_64
qemu-kvm-1.5.3-31.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Create a imge of libiscsi lun with "-o preallocation=metadata,cluster_size=2048k"
# qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=2048k iscsi://10.66.4.204:3260/iqn.2014-01.com.example:juli/6 30G


Actual results:
qemu-img: block/qcow2-cluster.c:1187: qcow2_alloc_cluster_offset: Assertion `n_start * (1ULL << 9) == offset_into_cluster(s, offset)' failed.
Aborted (core dumped)

Expected results:
not core dumped

Additional info:
# gdb qemu-img
(gdb) set args create -f qcow2 -o preallocation=metadata,cluster_size=2048k iscsi://10.66.4.204:3260/iqn.2014-01.com.example:juli/6 30G
(gdb) r
Starting program: /usr/bin/qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=2048k iscsi://10.66.4.204:3260/iqn.2014-01.com.example:juli/6 30G
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Formatting 'iscsi://10.66.4.204:3260/iqn.2014-01.com.example:juli/6', fmt=qcow2 size=32212254720 encryption=off cluster_size=2097152 preallocation='metadata' lazy_refcounts=off 
qemu-img: block/qcow2-cluster.c:1187: qcow2_alloc_cluster_offset: Assertion `n_start * (1ULL << 9) == offset_into_cluster(s, offset)' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff6079979 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff6079979 in raise () from /lib64/libc.so.6
#1  0x00007ffff607b088 in abort () from /lib64/libc.so.6
#2  0x00007ffff60728e6 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007ffff6072992 in __assert_fail () from /lib64/libc.so.6
#4  0x0000555555587d99 in qcow2_alloc_cluster_offset ()
#5  0x000055555558e2a7 in qcow2_create ()
#6  0x0000555555572c79 in bdrv_create_co_entry ()
#7  0x00005555555a8ada in coroutine_trampoline ()
#8  0x00007ffff608b4f0 in ?? () from /lib64/libc.so.6
#9  0x00007fffffffdb10 in ?? ()
#10 0x0000000000000000 in ?? ()

Comment 2 Hanna Reitz 2014-01-24 14:27:55 UTC
I believe this to be another aspect of bug 1055848 (not a duplicate, but the series posted by Hu Tao should fix both bugs).

Comment 3 Miroslav Rezanina 2014-02-19 08:47:53 UTC
Fix included in qemu-kvm-1.5.3-49.el7

Comment 5 mazhang 2014-02-24 09:58:53 UTC
Reproduce this bug with qemu-img-1.5.3-41.el7.x86_64.

Starting program: /usr/bin/qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=2048k iscsi://10.66.106.27:3260/iqn.2001-04.com.example:storage.mazhang.target0/3 30G
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Formatting 'iscsi://10.66.106.27:3260/iqn.2001-04.com.example:storage.mazhang.target0/3', fmt=qcow2 size=32212254720 encryption=off cluster_size=2097152 preallocation='metadata' lazy_refcounts=off 
qemu-img: block/qcow2-cluster.c:1187: qcow2_alloc_cluster_offset: Assertion `n_start * (1ULL << 9) == offset_into_cluster(s, offset)' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff607b979 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glib2-2.36.3-4.el7.x86_64 glibc-2.17-40.el7.x86_64 glusterfs-api-3.4.0.59rhs-1.el7.x86_64 glusterfs-libs-3.4.0.59rhs-1.el7.x86_64 libaio-0.3.109-10.el7.x86_64 libgcrypt-1.5.3-1.el7.x86_64 libgpg-error-1.12-1.el7.x86_64 libiscsi-1.9.0-4.el7.x86_64 libuuid-2.23.2-7.el7.x86_64 openssl-libs-1.0.1e-25.el7.x86_64 zlib-1.2.7-13.el7.x86_64
(gdb) bt
#0  0x00007ffff607b979 in raise () from /lib64/libc.so.6
#1  0x00007ffff607d088 in abort () from /lib64/libc.so.6
#2  0x00007ffff60748e6 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007ffff6074992 in __assert_fail () from /lib64/libc.so.6
#4  0x0000555555589b89 in qcow2_alloc_cluster_offset (bs=bs@entry=0x555555c22e50, offset=offset@entry=2147483136, n_start=n_start@entry=0, n_end=n_end@entry=4194303, 
    num=num@entry=0x7ffff7fd7cac, host_offset=host_offset@entry=0x7ffff7fd7cb0, m=m@entry=0x7ffff7fd7cb8) at block/qcow2-cluster.c:1187
#5  0x000055555558f6cb in preallocate (bs=0x555555c22e50) at block/qcow2.c:1403
#6  0x0000555555590332 in qcow2_create2 (errp=0x7ffff7fd7f40, version=3, options=<optimized out>, prealloc=<optimized out>, cluster_size=<optimized out>, flags=<optimized out>, 
    backing_format=0x0, backing_file=0x0, total_size=62914560, filename=0x555555c22bd0 "iscsi://10.66.106.27:3260/iqn.2001-04.com.example:storage.mazhang.target0/3")
    at block/qcow2.c:1584
#7  qcow2_create (filename=0x555555c22bd0 "iscsi://10.66.106.27:3260/iqn.2001-04.com.example:storage.mazhang.target0/3", options=<optimized out>, errp=0x7ffff7fd7fa0)
    at block/qcow2.c:1665
#8  0x0000555555573a89 in bdrv_create_co_entry (opaque=0x7fffffffe190) at block.c:377
#9  0x00005555555aed6a in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at coroutine-ucontext.c:118
#10 0x00007ffff608d4f0 in ?? () from /lib64/libc.so.6
#11 0x00007fffffffd9f0 in ?? ()
#12 0x0000000000000000 in ?? ()


Verify this bug with qemu-img-1.5.3-49.el7.x86_64.

Host:
qemu-kvm-common-1.5.3-49.el7.x86_64
qemu-kvm-tools-1.5.3-49.el7.x86_64
qemu-kvm-1.5.3-49.el7.x86_64
qemu-img-1.5.3-49.el7.x86_64
libvirt-daemon-driver-qemu-1.1.1-22.el7.x86_64
qemu-kvm-debuginfo-1.5.3-49.el7.x86_64

Result:
[root@m1 ~]# qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=2048k iscsi://10.66.106.27:3260/iqn.2001-04.com.example:storage.mazhang.target0/3 9G
Formatting 'iscsi://10.66.106.27:3260/iqn.2001-04.com.example:storage.mazhang.target0/3', fmt=qcow2 size=9663676416 encryption=off cluster_size=2097152 preallocation='metadata' lazy_refcounts=off 
[root@m1 ~]# qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=512k iscsi://10.66.106.27:3260/iqn.2001-04.com.example:storage.mazhang.target0/3 9G
Formatting 'iscsi://10.66.106.27:3260/iqn.2001-04.com.example:storage.mazhang.target0/3', fmt=qcow2 size=9663676416 encryption=off cluster_size=524288 preallocation='metadata' lazy_refcounts=off
[root@m1 ~]# qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=1024k iscsi://10.66.106.27:3260/iqn.2001-04.com.example:storage.mazhang.target0/3 9G
Formatting 'iscsi://10.66.106.27:3260/iqn.2001-04.com.example:storage.mazhang.target0/3', fmt=qcow2 size=9663676416 encryption=off cluster_size=1048576 preallocation='metadata' lazy_refcounts=off
[root@m1 ~]# qemu-img create -f qcow2 -o preallocation=off,cluster_size=2048k iscsi://10.66.106.27:3260/iqn.2001-04.com.example:storage.mazhang.target0/3 9G
Formatting 'iscsi://10.66.106.27:3260/iqn.2001-04.com.example:storage.mazhang.target0/3', fmt=qcow2 size=9663676416 encryption=off cluster_size=2097152 preallocation='off' lazy_refcounts=off

This bug has been fixed.

Comment 7 Ludek Smid 2014-06-13 10:02:39 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.