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 2171384 - Should report error when trying to hotplug virtiofs devices with the same target dir
Summary: Should report error when trying to hotplug virtiofs devices with the same tar...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.2
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Lili Zhu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-02-20 09:10 UTC by yafu
Modified: 2023-11-07 09:36 UTC (History)
5 users (show)

Fixed In Version: libvirt-9.5.0-0rc1.1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-07 08:30:47 UTC
Type: Bug
Target Upstream Version: 9.5.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-149188 0 None None None 2023-02-20 09:12:04 UTC
Red Hat Product Errata RHSA-2023:6409 0 None None None 2023-11-07 08:31:33 UTC

Description yafu 2023-02-20 09:10:21 UTC
Description of problem:
Should report error when trying to hotplug virtiofs device with the same target dir

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

How reproducible:
100%

Steps to Reproduce:
1.Prepare two virtiofs devices with the same target dir:
#cat fs1.xml
<filesystem accessmode="passthrough" type="mount">
  <driver queue="512" type="virtiofs" />
  <source dir="/var/tmp/mount_tag1" />
  **<target dir="mount_tag0" />**
  <binary path="/usr/libexec/virtiofsd" xattr="on">
    <cache mode="none" />
    <lock flock="off" posix="off" />
  </binary>
</filesystem>

#cat fs2.xml
<filesystem accessmode="passthrough" type="mount">
  <driver queue="512" type="virtiofs" />
  <source dir="/var/tmp/mount_tag2" />
  **<target dir="mount_tag0" />**
  <binary path="/usr/libexec/virtiofsd" xattr="on">
    <cache mode="none" />
    <lock flock="off" posix="off" />
  </binary>
</filesystem>

2.Hotplug the virtiofs devices to the guest:
#virsh attach-device test fs1.xml
#virsh attach-device test fs2.xml

3.Check the xml devices in guest xml:
#virsh dumpxml test --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_tag2"/>
  **<target dir="mount_tag0"/>**
  <alias name="ua-8d50d10c-719d-11ed-91f4-3a40aa736633"/>
  <address type="pci" domain="0x0000" bus="0x0a" slot="0x00" function="0x0"/>
</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_tag1"/>
  **<target dir="mount_tag0"/>**
  <alias name="ua-8d50d10c-719d-11ed-91f4-3a40aa736613"/>
  <address type="pci" domain="0x0000" bus="0x0b" slot="0x00" function="0x0"/>
</filesystem>

3.

Actual results:
Hotplugging virtiofs devices with the same target dir can successfully, but 
can only mount 1 virtiofs device in the guest os.

Expected results:
Should report error when trying to hotplug virtiofs devices with the same target dir

Additional info:
1.Will report error if edit two virtiofs devices with the same target dir:
#virsh edit test
error: unsupported configuration: filesystem target 'mount_tag0' specified twice
Failed. Try again? [y,n,i,f,?]:

Comment 1 Ján Tomko 2023-06-07 15:57:50 UTC
Upstream patch:
https://listman.redhat.com/archives/libvir-list/2023-June/240227.html

Comment 2 Ján Tomko 2023-06-13 07:20:18 UTC
commit a7ee9eac835324854483a231d7931b9329f259bc
Author:     Ján Tomko <jtomko>
CommitDate: 2023-06-12 13:06:31 +0200

    conf: virtiofs: validate that the target dir is unique even for hotplug
    
    https://bugzilla.redhat.com/show_bug.cgi?id=2171384
    
    Signed-off-by: Ján Tomko <jtomko>
    Reviewed-by: Martin Kletzander <mkletzan>

git describe: v9.4.0-58-ga7ee9eac83

Comment 5 Lili Zhu 2023-07-09 03:44:02 UTC
Tested this bug with:
libvirt-9.5.0-0rc1.1.el9.x86_64

1.Prepare two virtiofs devices with the same target dir:
#cat fs1.xml
<filesystem accessmode="passthrough" type="mount">
  <driver queue="512" type="virtiofs" />
  <source dir="/var/tmp/mount_tag1" />
  **<target dir="mount_tag0" />**
  <binary path="/usr/libexec/virtiofsd" xattr="on">
    <cache mode="none" />
    <lock flock="off" posix="off" />
  </binary>
</filesystem>

#cat fs2.xml
<filesystem accessmode="passthrough" type="mount">
  <driver queue="512" type="virtiofs" />
  <source dir="/var/tmp/mount_tag2" />
  **<target dir="mount_tag0" />**
  <binary path="/usr/libexec/virtiofsd" xattr="on">
    <cache mode="none" />
    <lock flock="off" posix="off" />
  </binary>
</filesystem>

2.Hotplug the virtiofs devices to the guest:
#virsh attach-device rhel9.3 fs1.xml
Device attached successfully

3.Attach the second virtiofs
# virsh attach-device rhel9.3 fs2.xml 
error: Failed to attach device from fs2.xml
error: unsupported configuration: filesystem target 'mount_tag0' specified twice

Comment 8 Lili Zhu 2023-08-07 05:58:41 UTC
Verify this bug with:
libvirt-9.5.0-3.el9.x86_64

SC1:

1. define a guest with two filesystems with the same target dir
<filesystem accessmode="passthrough" type="mount">
  <driver queue="512" type="virtiofs" />
  <source dir="/var/tmp/mount_tag1" />
  **<target dir="mount_tag0" />**
  <binary path="/usr/libexec/virtiofsd" xattr="on">
    <cache mode="none" />
    <lock flock="off" posix="off" />
  </binary>
</filesystem>
<filesystem accessmode="passthrough" type="mount">
  <driver queue="512" type="virtiofs" />
  <source dir="/var/tmp/mount_tag2" />
  **<target dir="mount_tag0" />**
  <binary path="/usr/libexec/virtiofsd" xattr="on">
    <cache mode="none" />
    <lock flock="off" posix="off" />
  </binary>
</filesystem>


SC2:
1.Prepare two virtiofs devices with the same target dir:
#cat fs1.xml
<filesystem accessmode="passthrough" type="mount">
  <driver queue="512" type="virtiofs" />
  <source dir="/var/tmp/mount_tag1" />
  **<target dir="mount_tag0" />**
  <binary path="/usr/libexec/virtiofsd" xattr="on">
    <cache mode="none" />
    <lock flock="off" posix="off" />
  </binary>
</filesystem>

#cat fs2.xml
<filesystem accessmode="passthrough" type="mount">
  <driver queue="512" type="virtiofs" />
  <source dir="/var/tmp/mount_tag2" />
  **<target dir="mount_tag0" />**
  <binary path="/usr/libexec/virtiofsd" xattr="on">
    <cache mode="none" />
    <lock flock="off" posix="off" />
  </binary>
</filesystem>

2.Hotplug the virtiofs devices to the guest:
#virsh attach-device rhel9.3 fs1.xml
Device attached successfully

3.Attach the second virtiofs
# virsh attach-device rhel9.3 fs2.xml 
error: Failed to attach device from fs2.xml
error: unsupported configuration: filesystem target 'mount_tag0' specified twice

2. define the guest
# virsh define lizhu.xml 
error: Failed to define domain from lizhu.xml
error: unsupported configuration: filesystem target 'mount_tag0' specified twice

SC3:

1. start a guest with filesystem
# virsh dumpxml lizhu --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_tag1"/>
  <target dir="mount_tag0"/>
  <alias name="fs0"/>
  <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</filesystem>

2. attach the following filesystem to the guest
# cat fs2.xml 
<filesystem accessmode="passthrough" type="mount">
  <driver queue="512" type="virtiofs" />
  <source dir="/var/tmp/mount_tag2" />
  <target dir="mount_tag0" />
  <binary path="/usr/libexec/virtiofsd" xattr="on">
    <cache mode="none" />
    <lock flock="off" posix="off" />
  </binary>
</filesystem>

3. try to attach it
# virsh attach-device lizhu fs2.xml 
error: Failed to attach device from fs2.xml
error: unsupported configuration: filesystem target 'mount_tag0' specified twice

Mark the bug as verified.

Comment 10 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


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