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 1975940

Summary: qemu-img convert: unshare write permission for source
Product: Red Hat Enterprise Linux 8 Reporter: Xueqiang Wei <xuwei>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
qemu-kvm sub component: Storage QA Contact: Tingting Mao <timao>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: medium    
Priority: medium CC: chayang, coli, jinzhao, juzhang, kkiwi, kwolf, qzhang, timao, virt-maint, xuwei
Version: 8.5Keywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.6   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1975941 (view as bug list) Environment:
Last Closed: 2021-09-17 07:56:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1997410    
Bug Blocks: 1975941    

Description Xueqiang Wei 2021-06-24 19:10:30 UTC
Description of problem:

Converting a raw format image to itself, we should let qemu-img convert unshare the write permission. Locking automatically like qcow2 image.



Discussed it with Kevin before, he had sent out the patches. Report this bug to track it. 
He said these patches have been merged only after the 6.0 release, immediately after the 6.1 development tree had opened.

commit 0b8fb55ce6398d7277b5ba0f19e39ec30a058191
[PATCH 0/2] qemu-img convert: Unshare write permission for source
commit 35b7f4abd5afe159f91ddeb4f2a40c20d2f48367
[PATCH 1/2] block: Add BDRV_O_NO_SHARE for blk_new_open()



Version-Release number of selected component (if applicable):
kernel-4.18.0-310.el8.x86_64
qemu-kvm-6.0.0-20.module+el8.5.0+11499+199527ef


How reproducible:
100%


Steps to Reproduce:
1. create a raw format image
# qemu-img create -f raw test.img 2G

2. Convert the image to itself
# qemu-img convert -p -f raw -O raw -S 0 test.img test.img




Actual results:
after step 2, convert successfully.
(100.00/100%)


Expected results:
Failed to convert image, locking automatically like qcow2 image.
The output like 'qemu-img: test.img: error while converting raw: Failed to get "write" lock
Is another process using the image [test.img]?'


Additional info:

Comment 1 Klaus Heinrich Kiwi 2021-06-28 19:40:19 UTC
Can we set this one to POST? Do we need to backport to 8.5 AV, or will we rebase it with 6.1+?

Comment 2 Kevin Wolf 2021-06-29 11:26:19 UTC
We should set POST only together with the other information, but yes, you're right that waiting for the rebase is good enough for this one.

Comment 3 John Ferlan 2021-09-09 11:56:57 UTC
Bulk update: Move RHEL-AV bugs to RHEL8 with existing RHEL9 clone.

Comment 4 John Ferlan 2021-09-09 11:58:16 UTC
Please provide qa_ack+/ITM as this is resolved by qemu-6.1 rebase bug 1997410

Comment 5 Tingting Mao 2021-09-10 05:56:58 UTC
Verified this bug as below:


Tested with:
qemu-kvm-6.1.0-1.module+el8.6.0+12535+4e2af250
kernel-4.18.0-339.el8.x86_64


Steps:
# qemu-img create -f raw test.img 2G

# qemu-img convert -p -f raw -O raw -S 0 test.img test.img
qemu-img: test.img: error while converting raw: Failed to get "write" lock
Is another process using the image [test.img]?


Results:
As above, the image is locked.