Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

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:
Embargoed:

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