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 1599335 - Image creation locking is too tight and is not properly released
Summary: Image creation locking is too tight and is not properly released
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Hanna Czenczek
QA Contact: Tingting Mao
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-09 14:24 UTC by Hanna Czenczek
Modified: 2018-11-01 11:15 UTC (History)
10 users (show)

Fixed In Version: qemu-kvm-rhev-2.12.0-8.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-11-01 11:13:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3443 0 None None None 2018-11-01 11:15:19 UTC

Description Hanna Czenczek 2018-07-09 14:24:20 UTC
Description of problem:

Instead of forbidding concurrent truncations, file-posix does the opposite.  Because qemu always needs other permissions for truncation besides RESIZE itself, this still means concurrent truncations are effectively disallowed.  But it also means that valid concurrent uses are disallowed as well.

Furthermore, the file locks are not released before the FD is closed.  This may lead to locks staying applied when working with fdsets.


Steps to Reproduce:
$ qemu-img create -f raw -o preallocation=full foo.img 1G &; qemu-io -c info -c close -r foo.img

Actual results:
Formatting 'foo.img', fmt=raw size=1073741824 preallocation=full
can't open device foo.img: Failed to get "consistent read" lock
Is another process using the image?


Expected results:
Formatting 'foo.img', fmt=raw size=1073741824 preallocation=full
format name: raw
cluster size: 0 bytes
vm state offset: 0 bytes

Comment 2 Hanna Czenczek 2018-07-09 14:40:28 UTC
Correction for the reproduction step:
$ qemu-img create -f raw -o preallocation=full foo.img 1G &; sleep 0.5; qemu-io -c info -c close -r foo.img

(Otherwise, the image file may or may not exist before qemu-io runs)

Comment 4 Miya Chen 2018-07-10 04:09:24 UTC
Max, we are not able to reproduce this bz by using the steps you provided:

# qemu-img create -f raw -o preallocation=full foo.img 1G &  sleep 0.5; qemu-io -c info -c close -r foo.img
[1] 16582
Formatting 'foo.img', fmt=raw size=1073741824 preallocation=full
format name: raw
cluster size: 0 bytes
vm state offset: 0 bytes

# rpm -qa |grep qemu-img
qemu-img-rhev-2.12.0-1.el7.x86_64

Comment 5 Ping Li 2018-07-10 05:48:53 UTC
Based on my testing results, this bz should be a regression since qemu-kvm-rhev-2.12.0-7.el7.

# qemu-img --version
qemu-img version 2.12.0 (qemu-kvm-rhev-2.12.0-6.el7)
# qemu-img create -f raw -o preallocation=full foo.img 1G &  sleep 0.5; qemu-io -c info -c close -r foo.img
[1] 19257
Formatting 'foo.img', fmt=raw size=1073741824 preallocation=full
format name: raw
cluster size: 0 bytes
vm state offset: 0 bytes

# qemu-img --version
qemu-img version 2.12.0 (qemu-kvm-rhev-2.12.0-7.el7)
# qemu-img create -f raw -o preallocation=full foo.img 1G &  sleep 0.5; qemu-io -c info -c close -r foo.img
[1] 19485
Formatting 'foo.img', fmt=raw size=1073741824 preallocation=full
can't open device foo.img: Failed to get "consistent read" lock
Is another process using the image?

Comment 6 Hanna Czenczek 2018-07-11 09:56:29 UTC
Yes, that is correct.  This is an issue with the backport for BZ 1519144, which was included in 2.12.0-7.

Sorry I did not specify the downstream version.

Max

Comment 7 Miroslav Rezanina 2018-07-24 14:40:43 UTC
Fix included in qemu-kvm-rhev-2.12.0-8.el7

Comment 9 Tingting Mao 2018-07-26 05:15:57 UTC
Verified this issue like below.

Package tested:
qemu-kvm-rhev-2.12.0-8.el7
kernel-3.10.0-926.el7

Steps:
# qemu-img create -f raw -o preallocation=full foo.img 1G &  sleep 0.5; qemu-io -c info -c close -r foo.img
[1] 12008
Formatting 'foo.img', fmt=raw size=1073741824 preallocation=full
format name: raw
cluster size: 0 bytes
vm state offset: 0 bytes

Comment 10 errata-xmlrpc 2018-11-01 11:13:00 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://access.redhat.com/errata/RHBA-2018:3443


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