Bug 2171973

Summary: Unexpected error show in virtqemud log when detaching a virtiofs device
Product: Red Hat Enterprise Linux 9 Reporter: yafu <yafu>
Component: libvirtAssignee: Ján Tomko <jtomko>
libvirt sub component: General QA Contact: Lili Zhu <lizhu>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: jdenemar, jsuchane, lizhu, lmen, mprivozn, virt-maint
Version: 9.2Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-9.2.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:30:47 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: 9.2.0
Embargoed:

Description yafu 2023-02-21 03:45:13 UTC
Description of problem:
Unexpected error show in virttqemud log when detaching a virtiofs device

Version-Release number of selected component (if applicable):
libvirt-9.0.0-6.el9.x86_64
qemu-kvm-7.2.0-9.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1.1.Start a guest with virtiofs device:
#virsh start test2

#virsh dumpxml test2 --xpath //filesystem
<filesystem type="mount" accessmode="passthrough">
  <driver type="virtiofs" queue="512"/>
  <binary path="/usr/libexec/virtiofsd" xattr="on">
    <cache mode="none"/>
    <lock posix="off" flock="off"/>
  </binary>
  <source dir="/var/tmp/mount_tag0"/>
  <target dir="mount_tag3"/>
  <alias name="ua-8d50d10c-719d-11ed-91f4-3a40aa736603"/>
  <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
</filesystem>

2.Hotunplug the virtiofs device:
#virsh detach-device-alias test2 ua-8d50d10c-719d-11ed-91f4-3a40aa736603

3.Check the virtiofs device in the active xml:
# virsh dumpxml test2 --xpath //filesystem
no output

4.Check the syslog:
#cat /var/log/messages
Feb 20 22:37:28 ** virtqemud[1536633]: 1536636: error : virPidFileAcquirePath:401 : Failed to acquire pid file '/run/libvirt/qemu/11-test2-ua-8d50d10c-719d-11ed-91f4-3a40aa736603-fs.pid': Resource temporarily unavailable

5.Check the virtiofsd log:
#vim /var/log/libvirt/qemu/test2-ua-8d50d10c-719d-11ed-91f4-3a40aa736603-virtiofsd.log
[2023-02-21T03:34:22Z INFO  virtiofsd] Waiting for vhost-user socket connection...
[2023-02-21T03:34:22Z INFO  virtiofsd] Client connected, servicing requests
[2023-02-21T03:37:28Z INFO  virtiofsd] Client disconnected, shutting down
~                                                                         


Actual results:
The virtiofsd device detached successfully but unexpected error show in virttqemud log.

Expected results:
No error show in virtqemud log if the virtiofsd device detached successfully.

Additional info:

Comment 1 Michal Privoznik 2023-02-21 14:00:18 UTC
This is because qemuVirtioFSStop() which is called internally to kill virtiofsd, calls virPidFileForceCleanupPathFull() -> virPidFileAcquirePath() which reports error if it failed to lock PID file. In case virtiofsd is still running (and thus has the PID file locked), it is expected that libvirt fails to lock the PID file. No report should be reported though.

Comment 2 Ján Tomko 2023-03-07 16:16:34 UTC
Patches posted upstream:
https://listman.redhat.com/archives/libvir-list/2023-March/238504.html

Comment 3 Ján Tomko 2023-03-08 11:20:35 UTC
commit 7e94712699546b0dc9ec8307b19a39775761627c
Author:     Ján Tomko <jtomko>
CommitDate: 2023-03-08 12:16:56 +0100

    util: do not report errors in virPidFileForceCleanupPathFull
    
    Use the quiet version of virPidFileAcquirePath and remove the error
    reset, since there's nothing to reset anymore.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=2171973
    
    Signed-off-by: Ján Tomko <jtomko>
    Reviewed-by: Martin Kletzander <mkletzan>

git describe: v9.1.0-162-g7e94712699

Comment 4 Lili Zhu 2023-04-06 09:23:12 UTC
Tested with:
libvirt-9.2.0-1.el9.x86_64

Repeat Step1 to Step3 in https://bugzilla.redhat.com/show_bug.cgi?id=2171973#c0

4. check the log
# grep -ni "Failed to acquire pid" /var/log/libvirt/virtqemud.log

(no output)

Comment 7 Lili Zhu 2023-05-19 07:50:46 UTC
Tested with:
libvirt-9.3.0-1.el9.x86_64
qemu-kvm-8.0.0-1.el9.x86_64

Testing steps are the same with those in Comment #4

As the testing result matches with the expected one, mark the bug as verified.

Comment 9 errata-xmlrpc 2023-11-07 08:30:47 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 (Moderate: libvirt security, bug fix, and enhancement update), 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/RHSA-2023:6409