Bug 2078443

Summary: Failed to get shared "write" lock when opening a QEMU VM image immediately after guestunmount
Product: [Fedora] Fedora Reporter: Coiby <coxu>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 37CC: rjones
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-12-05 21:06:21 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 Coiby 2022-04-25 10:47:06 UTC
Description of problem:

If I try open an QEMU VM immediately after guestunmount a QEMU VM image, the following error occurs,
qemu-img: Could not open 'Fedora-Cloud-Base-35-1.2.x86_64.qcow2': Failed to get shared "write" lock


Version-Release number of selected component (if applicable):
libguestfs-1:1.48.1-1.fc37

How reproducible:
always

Steps to Reproduce:
1. dnf install libguestfs -y
2. mount a QEMU VM image 
LIBGUESTFS_BACKEND=direct guestmount -a Fedora-Cloud-Base-35-1.2.x86_64.qcow2 -i t
3. run "qemu-img info" immediately after unmounting the image
LIBGUESTFS_BACKEND=direct guestunmount && qemu-img info Fedora-Cloud-Base-35-1.2.x86_64.qcow2

Actual results:

qemu-img complains "qemu-img: Could not open 'Fedora-Cloud-Base-35-1.2.x86_64.qcow2': Failed to get shared "write" lock". I need to wait for 1 second or more time before being able to run qemu-im info successfully.

Expected results:

qemu-img should return the image info normally.

Additional info:

This bug can be reproduced on f35 with libguestfs-1.48.0-1.fc35 as well.

Comment 1 Richard W.M. Jones 2022-04-25 10:55:59 UTC
You might try asking qemu-img to ignore locks (-U option).

However the more general problem is that qemu (attached to the disk
image) takes a little bit of time to exit and release the lock, and
it seems as if fusermount (guestmount is just a wrapper around this)
exits before this has happened.

You could try running guestmount with a lot more debugging enabled
(-v -x) to see if you can identify exactly where the race happens.

Comment 2 Ben Cotton 2022-08-09 13:15:02 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.

Comment 3 Aoife Moloney 2023-11-23 00:11:21 UTC
This message is a reminder that Fedora Linux 37 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 37 on 2023-12-05.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '37'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 37 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 4 Aoife Moloney 2023-12-05 21:06:21 UTC
Fedora Linux 37 entered end-of-life (EOL) status on None.

Fedora Linux 37 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.