Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1055848 - qemu-img core dumped when cluster size is larger than the default value with opreallocation=metadata specified
Summary: qemu-img core dumped when cluster size is larger than the default value with ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Max Reitz
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-21 04:46 UTC by Sibiao Luo
Modified: 2014-06-18 03:45 UTC (History)
14 users (show)

Fixed In Version: qemu-kvm-1.5.3-49.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 09:50:29 UTC


Attachments (Terms of Use)

Description Sibiao Luo 2014-01-21 04:46:02 UTC
Description of problem:
qemu-img will core dumped when create a qcow2 image with cluster size is larger than the default value and opreallocation=metadata specified.
BTW, also tried the rhel6.5 host which did not hit such issue.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm
3.10.0-76.el7.x86_64
qemu-kvm-1.5.3-38.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.# qemu-img create -f qcow2 -o preallocation=metadata metadata_cluster_size.default_test 10GFormatting 'metadata_cluster_size.default_test', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 preallocation='metadata' lazy_refcounts=off 

2.# qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=64k metadata_cluster_size.64k_test 10G
Formatting 'metadata_cluster_size.64k_test', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 preallocation='metadata' lazy_refcounts=off 

3.# qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=128k metadata_cluster_size.128k_test 10G
Formatting 'metadata_cluster_size.128k_test', fmt=qcow2 size=10737418240 encryption=off cluster_size=131072 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.
Aborted (core dumped)

4.# qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=256k metadata_cluster_size.256k_test 10G
Formatting 'metadata_cluster_size.256k_test', fmt=qcow2 size=10737418240 encryption=off cluster_size=262144 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.
Aborted (core dumped)

5.# qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=2048k metadata_cluster_size.2048k_test 10G
Formatting 'metadata_cluster_size.2048k_test', fmt=qcow2 size=10737418240 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.
Aborted (core dumped)

Actual results:
Core was generated by `qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=128k metadata_c'.
Program terminated with signal 6, Aborted.
#0  0x00007f0840e14979 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007f0840e14979 in raise () from /lib64/libc.so.6
#1  0x00007f0840e16088 in abort () from /lib64/libc.so.6
#2  0x00007f0840e0d8e6 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007f0840e0d992 in __assert_fail () from /lib64/libc.so.6
#4  0x00007f0842dcd979 in qcow2_alloc_cluster_offset (bs=bs@entry=0x7f0843ad5e40, offset=offset@entry=2147483136, 
    n_start=n_start@entry=0, n_end=n_end@entry=4194303, num=num@entry=0x7f0842d77cac, 
    host_offset=host_offset@entry=0x7f0842d77cb0, m=m@entry=0x7f0842d77cb8) at block/qcow2-cluster.c:1187
#5  0x00007f0842dd34bb in preallocate (bs=0x7f0843ad5e40) at block/qcow2.c:1403
#6  0x00007f0842dd4122 in qcow2_create2 (errp=0x7f0842d77f40, version=3, options=<optimized out>, 
    prealloc=<optimized out>, cluster_size=<optimized out>, flags=<optimized out>, backing_format=0x0, backing_file=0x0, 
    total_size=20971520, filename=0x7f0843ad4bd0 "metadata_cluster_size.128k_test") at block/qcow2.c:1584
#7  qcow2_create (filename=0x7f0843ad4bd0 "metadata_cluster_size.128k_test", options=<optimized out>, 
    errp=0x7f0842d77fa0) at block/qcow2.c:1665
#8  0x00007f0842db7929 in bdrv_create_co_entry (opaque=0x7fff5f9a46e0) at block.c:376
#9  0x00007f0842df2b4a in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at coroutine-ucontext.c:118
#10 0x00007f0840e26550 in ?? () from /lib64/libc.so.6
#11 0x00007fff5f9a3f40 in ?? ()
#12 0x0000000000000000 in ?? ()
(gdb) bt full
#0  0x00007f0840e14979 in raise () from /lib64/libc.so.6
No symbol table info available.
#1  0x00007f0840e16088 in abort () from /lib64/libc.so.6
No symbol table info available.
#2  0x00007f0840e0d8e6 in __assert_fail_base () from /lib64/libc.so.6
No symbol table info available.
#3  0x00007f0840e0d992 in __assert_fail () from /lib64/libc.so.6
No symbol table info available.
#4  0x00007f0842dcd979 in qcow2_alloc_cluster_offset (bs=bs@entry=0x7f0843ad5e40, offset=offset@entry=2147483136, 
    n_start=n_start@entry=0, n_end=n_end@entry=4194303, num=num@entry=0x7f0842d77cac, 
    host_offset=host_offset@entry=0x7f0842d77cb0, m=m@entry=0x7f0842d77cb8) at block/qcow2-cluster.c:1187
        s = 0x7f0843ad7450
        start = <optimized out>
        remaining = <optimized out>
        cluster_offset = <optimized out>
        cur_bytes = <optimized out>
        __PRETTY_FUNCTION__ = "qcow2_alloc_cluster_offset"
#5  0x00007f0842dd34bb in preallocate (bs=0x7f0843ad5e40) at block/qcow2.c:1403
        nb_sectors = 16777217
        offset = 2147483136
        host_offset = 655360
        num = 4194303
        ret = <optimized out>
        meta = 0x7f0843adae40
#6  0x00007f0842dd4122 in qcow2_create2 (errp=0x7f0842d77f40, version=3, options=<optimized out>, 
    prealloc=<optimized out>, cluster_size=<optimized out>, flags=<optimized out>, backing_format=0x0, backing_file=0x0, 
    total_size=20971520, filename=0x7f0843ad4bd0 "metadata_cluster_size.128k_test") at block/qcow2.c:1584
        s = 0x7f0843ad7450
        local_err = 0x0
        ret = 0
        cluster_bits = <optimized out>
        bs = 0x7f0843ad5e40
        header = <optimized out>
        refcount_table = 0x7f0843ad8400 "\330\235\031A\b\177"
        drv = <optimized out>
#7  qcow2_create (filename=0x7f0843ad4bd0 "metadata_cluster_size.128k_test", options=<optimized out>, 
    errp=0x7f0842d77fa0) at block/qcow2.c:1665
        backing_file = <optimized out>
        backing_fmt = <optimized out>
        sectors = <optimized out>
        flags = <optimized out>
        cluster_size = <optimized out>
        prealloc = <optimized out>
        version = <optimized out>
        local_err = 0x0
#8  0x00007f0842db7929 in bdrv_create_co_entry (opaque=0x7fff5f9a46e0) at block.c:376
        local_err = 0x0
        ret = <optimized out>
        cco = 0x7fff5f9a46e0
#9  0x00007f0842df2b4a in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at coroutine-ucontext.c:118
        self = 0x7f0843ad4c00
        co = 0x7f0843ad4c00
#10 0x00007f0840e26550 in ?? () from /lib64/libc.so.6
No symbol table info available.
#11 0x00007fff5f9a3f40 in ?? ()
No symbol table info available.
#12 0x0000000000000000 in ?? ()
No symbol table info available.
(gdb)

Expected results:
It should no any core dumped occur.

Additional info:

Comment 2 Miroslav Rezanina 2014-02-19 08:48:00 UTC
Fix included in qemu-kvm-1.5.3-49.el7

Comment 4 mazhang 2014-02-24 09:15:26 UTC
Reproduce this bug with qemu-img-1.5.3-48.el7.x86_64.

Starting program: /usr/bin/qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=2048k metadata_cluster_size.2048k_test 10G
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Formatting 'metadata_cluster_size.2048k_test', fmt=qcow2 size=10737418240 encryption=off cluster_size=2097152 preallocation='metadata' lazy_refcounts=off 
[New Thread 0x7ffff515a700 (LWP 6891)]
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  0x0000555555586c39 in qcow2_alloc_cluster_offset (bs=bs@entry=0x555555c13e70, 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  0x000055555558c2ab in preallocate (bs=0x555555c13e70) at block/qcow2.c:1411
#6  0x000055555558ce82 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=20971520, 
    filename=0x555555c12c00 "metadata_cluster_size.2048k_test") at block/qcow2.c:1592
#7  qcow2_create (filename=0x555555c12c00 "metadata_cluster_size.2048k_test", options=<optimized out>, errp=0x7ffff7fd7fa0)
    at block/qcow2.c:1673
#8  0x00005555555732f9 in bdrv_create_co_entry (opaque=0x7fffffffe1c0) at block.c:387
#9  0x00005555555a8a1a in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at coroutine-ucontext.c:118
#10 0x00007ffff608d4f0 in ?? () from /lib64/libc.so.6
#11 0x00007fffffffda30 in ?? ()
#12 0x0000000000000000 in ?? ()



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

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

Result:
(gdb) r create -f qcow2 -o preallocation=metadata,cluster_size=256k metadata_cluster_size.256k_test 10G
Starting program: /usr/bin/qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=256k metadata_cluster_size.256k_test 10G
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Formatting 'metadata_cluster_size.256k_test', fmt=qcow2 size=10737418240 encryption=off cluster_size=262144 preallocation='metadata' lazy_refcounts=off 
[New Thread 0x7ffff535b700 (LWP 7160)]
[Thread 0x7ffff535b700 (LWP 7160) exited]
[Inferior 1 (process 7159) exited normally]
(gdb) r create -f qcow2 -o preallocation=metadata,cluster_size=256k metadata_cluster_size.256k_test 10G
Starting program: /usr/bin/qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=256k metadata_cluster_size.256k_test 10G
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Formatting 'metadata_cluster_size.256k_test', fmt=qcow2 size=10737418240 encryption=off cluster_size=262144 preallocation='metadata' lazy_refcounts=off 
[New Thread 0x7ffff535b700 (LWP 7162)]
[Thread 0x7ffff535b700 (LWP 7162) exited]
[Inferior 1 (process 7161) exited normally]
(gdb) r create -f qcow2 -o preallocation=metadata,cluster_size=2048k metadata_cluster_size.2048k_test 10G
Starting program: /usr/bin/qemu-img create -f qcow2 -o preallocation=metadata,cluster_size=2048k metadata_cluster_size.2048k_test 10G
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Formatting 'metadata_cluster_size.2048k_test', fmt=qcow2 size=10737418240 encryption=off cluster_size=2097152 preallocation='metadata' lazy_refcounts=off 

This bug has been fixed.

Comment 6 Ludek Smid 2014-06-13 09:50:29 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.


Note You need to log in before you can comment on or make changes to this bug.