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 2042247

Summary: [virtio-win][virtiofs] share more than one fs with virtio-fs for windiows guest
Product: Red Hat Enterprise Linux 9 Reporter: xiagao
Component: virtio-winAssignee: Virtualization Maintenance <virt-maint>
virtio-win sub component: virtio-win-prewhql QA Contact: xiagao
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: qizhu, vrozenfe, yvugenfi
Version: 9.0Keywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: x86_64   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:55:10 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:

Description xiagao 2022-01-19 06:07:22 UTC
Description of problem:
Currently for windows guest, can only get one shared directory in windows guest even though attach more than one shared directory.

Version-Release number of selected component (if applicable):
qemu-kvm-6.2.0-1.el9.x86_64
kernel-5.14.0-39.el9.x86_64
virtio-win-prewhql-0.1-215

How reproducible:
100%

Steps to Reproduce:
1.boot up windows guest with two shared dir
# /usr/libexec/virtiofsd --socket-path=/tmp/vhostqemu0 -o source=/tmp/virtiofs_test0 -o cache=always   
# /usr/libexec/virtiofsd --socket-path=/tmp/vhostqemu1 -o source=/tmp/virtiofs_test1 -o cache=always

#qemu-kvm \
......
-smp 2 \
-m 4G \
-object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on \
-numa node,memdev=mem \
-chardev socket,id=char0,path=/tmp/vhostqemu0 \
-device vhost-user-fs-pci,chardev=char0,tag=myfs0 \
-chardev socket,id=char1,path=/tmp/vhostqemu1 \
-device vhost-user-fs-pci,chardev=char1,tag=myfs1 \

3.install virtiofs driver and start virtiofs service
virtiofs.exe

Actual results:
There is no parameter from virtiofs.ext to define which shared directory is mounted.
I always mounted the first shared dir,such as the one tag=myfs0

Expected results:
Can mount more than one shared directory in windows guest

Additional info:
For linux guest, can mount more than one dir with tag.
#mount -t virtiofs myfs1 /mnt/test1
#mount -t virtiofs myfs2 /mnt/test2

Comment 1 Viktor Prutyanov 2022-08-01 09:11:34 UTC
Upstream PR to add initial support of multiple mounts: https://github.com/virtio-win/kvm-guest-drivers-windows/pull/804

How to test:
start "" virtiofs.exe -d -1 -D C:\viofs_debug0.txt -m Y: -t mount0
start "" virtiofs.exe -d -1 -D C:\viofs_debug1.txt -m Z: -t mount1

(or any other way to run several virtiofs.exe with different tags and mount points)

Comment 2 Vadim Rozenfeld 2022-08-03 01:03:53 UTC
please check with the drivers from build 223
https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=2109262

Comment 5 Viktor Prutyanov 2022-08-03 08:19:10 UTC
Hi Xiaoling,

is the problem reproduced without '-t'?

Comment 6 xiagao 2022-08-03 08:30:25 UTC
(In reply to Viktor Prutyanov from comment #5)
> Hi Xiaoling,
> 
> is the problem reproduced without '-t'?

yes, it still failed without '-m x: -t myfs1'

Comment 7 Viktor Prutyanov 2022-08-03 12:12:01 UTC
Could you please share security setting for the mounted drive in the guest?
Such as:
Right Click to Drive > Properties > Security
Right Click to Drive > Properties > Security > Advanced
Right Click to Drive > Properties > Security > Advanced > Edit (for each entry in Permissions) > Show Advanced permissions
PowerShell: Get-Acl | fl
CMD: dir /q

Comment 8 Viktor Prutyanov 2022-08-04 04:15:00 UTC
And also host permissions for shared folder, please

Comment 11 Viktor Prutyanov 2022-08-04 06:00:36 UTC
Hi Xiaoling,

Thank you for providing the information.
Could you please also share permissions for the shared folder itself (/home/test in your case)? For example, ls -la /home/test

Comment 13 Vadim Rozenfeld 2022-09-22 07:49:17 UTC
the fix included in build 226
https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=2176313

Comment 14 Viktor Prutyanov 2022-09-22 08:10:06 UTC
Manual how to setup multiple instances of VirtIO-FS:
https://github.com/virtio-win/kvm-guest-drivers-windows/wiki/VirtIO-FS:-Shared-file-system#multiple-virtio-fs-instances

Comment 15 xiagao 2022-09-27 08:16:51 UTC
Try build 226.
Can't access the shared volume in guest(attachment), so reassign back.

Seems the same reason with https://bugzilla.redhat.com/show_bug.cgi?id=2112559#c10

Comment 16 Yvugenfi@redhat.com 2022-10-06 08:31:56 UTC
New build should include the fix: virtio-win-prewhql-0.1-227

Comment 17 xiagao 2022-10-11 02:46:56 UTC
Test on virtio-win-prewhql-0.1-227, the driver letter name can't be changed when starting it with a service.

Register virtiofs service cmd:
 sc create VirtioFsSvc binpath="c:\virtiofs.exe -m O: -t myfs" start=auto depend="WinFsp.Launcher/VirtioFsDrv" DisplayName="Virtio FS Service"

Result:
It shows "Z:" in computer manager.

Comment 18 Viktor Prutyanov 2022-10-12 09:45:43 UTC
Hi
Windows service can't accept command-line arguments.
To specify mount point for VirtIO-FS Windows service use registry: https://github.com/virtio-win/kvm-guest-drivers-windows/wiki/VirtIO-FS:-Shared-file-system#options
Or use WinFsp's launchctl to run VirtIO-FS: https://github.com/virtio-win/kvm-guest-drivers-windows/wiki/VirtIO-FS:-Shared-file-system#multiple-virtio-fs-instances

Comment 19 xiagao 2022-10-13 06:39:12 UTC
(In reply to Viktor Prutyanov from comment #18)
> Hi
> Windows service can't accept command-line arguments.
> To specify mount point for VirtIO-FS Windows service use registry:
> https://github.com/virtio-win/kvm-guest-drivers-windows/wiki/VirtIO-FS:-
> Shared-file-system#options
Hi Viktor,
I have two mount points, how to modify both of them with registry.
The first one.
reg add HKLM\Software\VirtIO-FS /v MountPoint /d A: /t REG_SZ
Then how to set another? 

Thanks.

> Or use WinFsp's launchctl to run VirtIO-FS:
> https://github.com/virtio-win/kvm-guest-drivers-windows/wiki/VirtIO-FS:-
> Shared-file-system#multiple-virtio-fs-instances

Comment 23 Viktor Prutyanov 2022-10-17 11:53:50 UTC
Hi Xiaoling,

1) With WinFSP.Launcher you can run 1, 2 or more instances of VirtIO-FS. In this case '-t' can be used to specify tag.
2) A Windows service can be run only once, so the only one VirtIO-FS instance can be run by the service and no tag is required (if VirtIO-FS device is present it will be mounted regardless of tag).

At the moment, both variants are supported, but we're discussing with Yan about leaving only WinFSP.Launcher way.

Comment 24 xiagao 2022-10-18 07:54:10 UTC
(In reply to Viktor Prutyanov from comment #23)
> Hi Xiaoling,
> 
> 1) With WinFSP.Launcher you can run 1, 2 or more instances of VirtIO-FS. In
> this case '-t' can be used to specify tag.
OK, thanks for your explanation.

> 2) A Windows service can be run only once, so the only one VirtIO-FS
> instance can be run by the service and no tag is required (if VirtIO-FS
> device is present it will be mounted regardless of tag).
I guess it will mount the first VirtIO-FS device if there is more than one.


> 
> At the moment, both variants are supported, but we're discussing with Yan
> about leaving only WinFSP.Launcher way.
Yeah, I also agree with one way to start the shared volume, it's more simple and easy to manage, in case people need to keep in mind the usage of two ways. 

So for this bug, I think it can be verified. It works with WinFSP.Launcher way.

Comment 29 errata-xmlrpc 2023-05-09 07:55:10 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 (virtio-win 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/RHBA-2023:2451