Bug 1226297

Summary: qcow2 crash during discard operation
Product: Red Hat Enterprise Linux 7 Reporter: Kevin Wolf <kwolf>
Component: qemu-kvm-rhevAssignee: Kevin Wolf <kwolf>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: huding, juzhang, knoel, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.3.0-18.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-04 16:43:08 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 Kevin Wolf 2015-05-29 11:51:59 UTC
First reported in https://bugs.launchpad.net/qemu/+bug/1349972

Steps to reproduce:
1. Get the attached tarball from the Launchpad bug
2. Unpack test.img and backing_img.qed in the same directory (see the attached archives for images)
3. Make a copy of test.img to copy.img (qemu-io modifies the image before being kill, therefore the image backup is necessary)
4. qemu-io copy.img -c 'discard 2210816 2856448'

qemu-io: block/qcow2-refcount.c:468: update_refcount_discard: Assertion `d->bytes + length == new_end - new_start' failed.

Fixed upstream in commit ecbda7a2.

Comment 1 Miroslav Rezanina 2015-08-14 16:22:06 UTC
Fix included in qemu-kvm-rhev-2.3.0-18.el7

Comment 2 huiqingding 2015-08-18 03:19:14 UTC
Reproduce this bug using the following version:
qemu-kvm-rhev-2.3.0-16.el7.x86_64
qemu-img-rhev-2.3.0-16.el7.x86_64
kernel-3.10.0-304.el7.x86_64

Steps to Reproduce:
1. Get the tarball images.n.traces.tar.gz from the link of comment #0
2. unpack the tarball
# tar xzvf images.n.traces.tar.gz
3. copy test.img to copy.img
# cp test.img copy.img
4. run discard operation
# qemu-io copy.img -c 'discard 2210816 2856448'

Actual results:
after step4, output the info:
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Invalid argument
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Invalid argument
... ...
qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with refcount block); further corruption events will be suppressed
qemu-io: block/qcow2-refcount.c:645: update_refcount_discard: Assertion `d->bytes + length == new_end - new_start' failed.
Aborted

Comment 3 huiqingding 2015-08-18 03:22:47 UTC
Test this bug using the following version:
qemu-kvm-rhev-2.3.0-18.el7.x86_64
qemu-img-rhev-2.3.0-18.el7.x86_64
kernel-3.10.0-304.el7.x86_64

The test steps are same as comment #2

Test results:
after step4, output the info:
# qemu-io copy.img -c 'discard 2210816 2856448'
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Invalid argument
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Resource temporarily unavailable
qcow2_free_clusters failed: Invalid argument
... ...
qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with refcount block); further corruption events will be suppressed
discard failed: Input/output error

Comment 5 juzhang 2015-08-24 02:36:35 UTC
According to comment2 and comment3, set this issue as verified.

Comment 7 errata-xmlrpc 2015-12-04 16:43:08 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, 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://rhn.redhat.com/errata/RHBA-2015-2546.html