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 1925144 - [virtio-fs][RFE] Add a support for symbolic links
Summary: [virtio-fs][RFE] Add a support for symbolic links
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: virtio-win
Version: ---
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 8.0
Assignee: Virtualization Maintenance
QA Contact: xiagao
URL:
Whiteboard:
Depends On:
Blocks: 1948357 1950227
TreeView+ depends on / blocked
 
Reported: 2021-02-04 13:48 UTC by Gal Hammer
Modified: 2021-11-10 01:55 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 18:52:45 UTC
Type: Feature Request
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
picture of symbolic link on shared volume (115.39 KB, image/png)
2021-04-14 06:00 UTC, xiagao
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2021:4341 0 None None None 2021-11-09 18:53:03 UTC

Description Gal Hammer 2021-02-04 13:48:32 UTC
Add a support to create symbolic links (mklink) and be able to follow them.

Comment 5 menli@redhat.com 2021-02-05 03:45:15 UTC
Hi Gal,
 
I try to test this new support with following steps and pkg, but hit flowing issue, could you please help to confirm whether my steps are valid?
Please feel free to correct me, thanks in advance.



pkg:
virtio-win-prewhql-0.1-194.iso
qemu-kvm-5.2.0-4.module+el8.4.0+9676+589043b9.x86_64
seabios-bin-1.14.0-1.module+el8.4.0+8855+a9e237a9.noarch

here are my steps:

1. Create a shared directory for testing on the host.
e.g:
# mkdir -p /tmp/virtiofs_test	

2. Run the virtiofsd daemon on the host.
e.g:
# /usr/libexec/virtiofsd --socket-path=/tmp/vhostqemu -o source=/tmp/virtiofs_test -o cache=always
	
3. Boot a guest on the host.
e.g:
# /usr/libexec/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/vhostqemu \
-device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=myfs \
...
	
4. Log into guest then mount the file system 


for windows guest :
1) make sure virtio-fs driver is installed
2) install WINFSP in guest.(download winfsp installe: http://www.secfs.net/winfsp/rel/ )
3)Open virtio-win driver folder and run virtiofs.exe
virtiofs.exe -D - c:\virtiofs-log.txt -d -1
4)In computer we will have a new Z: drive

5.copy a folder(not blank) eg: tools to Z: 

6.access Z: and send command
Z:\ mklink /D test tools

actual result:

after step 6, error message'Cannot create a file when that file already exists .'

Addtional info:
if mklink a file on step 6 it will success. eg: Z:\ mklink  test  existingfile 


Thanks
Menghuan

Comment 14 menli@redhat.com 2021-02-23 09:09:58 UTC
Change it to ASSIGNED status for 'Fail to create a symbolic link to a directory'

Comment 16 xiagao 2021-04-07 03:27:34 UTC
Gal hi,
I know this bug is opened for symbolic links, but I also want to confirm if it supports creating a hard link or a directory junction?
Below is my testing in virtiofs and ntfs.

Z:\>mklink /h f1-hard-link f1
The request is not supported.

Z:\>mklink /j f1-link3 f1
Local volumes are required to complete the operation.


C:\>mklink /h f1-hard-link f1
Hardlink created for f1-hard-link <<===>> f1

C:\>mklink /j f1-link3 f1
Junction created for f1-link3 <<===>> f1

Thanks,
Xiaoling

Comment 17 Gal Hammer 2021-04-08 06:59:31 UTC
(In reply to xiagao from comment #16)
> Gal hi,
> I know this bug is opened for symbolic links, but I also want to confirm if
> it supports creating a hard link or a directory junction?
> Below is my testing in virtiofs and ntfs.
> 
> Z:\>mklink /h f1-hard-link f1
> The request is not supported.
> 
> Z:\>mklink /j f1-link3 f1
> Local volumes are required to complete the operation.
> 
> 
> C:\>mklink /h f1-hard-link f1
> Hardlink created for f1-hard-link <<===>> f1
> 
> C:\>mklink /j f1-link3 f1
> Junction created for f1-link3 <<===>> f1
> 
> Thanks,
> Xiaoling

It is not supported for now and will probably only be added if someone will request these.

BTW: I don't even known what "Directory Junction" is... ;-)

Comment 19 Gal Hammer 2021-04-08 07:20:46 UTC
Fix for the symbolic link to a directory: https://github.com/virtio-win/kvm-guest-drivers-windows/pull/566

Comment 20 Vadim Rozenfeld 2021-04-14 03:22:32 UTC
fix included into build 198 https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=1573292

Comment 21 xiagao 2021-04-14 05:59:47 UTC
Test with build 198.
Can create symbolic link with mklink command,but it's type is not correct.
The type is 'file' type for folder link,so can't open it.(see attachment)

steps:
1.create symbolic link for a file on shared volume(z:)
Z:\>mklink file-link file.txt
symbolic link created for file-link <<===>> file.txt

Z:\>mklink /d folder-link folder
symbolic link created for folder-link <<===>> folder

2.create symbolic link on ntfs volume(c:)
Z:\>c:
C:\>mklink file-link file.txt
symbolic link created for file-link <<===>> file.txt

C:\>mklink /d folder-link folder
symbolic link created for folder-link <<===>> folder

3.check the symbolic link.
C:\>dir
 Volume in drive C is Windows
 Volume Serial Number is 98C9-A511

 Directory of C:\

04/14/2021  01:41 AM    <SYMLINK>      file-link [file.txt]
04/14/2021  01:41 AM                 0 file.txt
04/14/2021  01:40 AM    <DIR>          folder
04/14/2021  01:41 AM    <SYMLINKD>     folder-link [folder]


C:\>z:

Z:\>dir
 Volume in drive Z is myfs_11
 Volume Serial Number is 0000-0000

 Directory of Z:\

01/01/1970  08:00 AM    <DIR>          .
01/01/1970  08:00 AM    <DIR>          ..
04/14/2021  01:39 PM                 0 file-link
04/14/2021  01:50 PM               469 file.txt
04/14/2021  01:39 PM    <DIR>          folder
04/14/2021  01:40 PM                 0 folder-link
               3 File(s)            475 bytes
               3 Dir(s)  462,578,851,840 bytes free

Comment 22 xiagao 2021-04-14 06:00:45 UTC
Created attachment 1771745 [details]
picture of symbolic link on shared volume

Comment 23 xiagao 2021-04-22 01:10:48 UTC
Needinfo Gal in case missing comment 21.

Comment 24 Gal Hammer 2021-04-27 08:38:00 UTC
The symbolic link issue was resolved, so moving to POST.

Comment 25 xiagao 2021-05-17 01:38:09 UTC
Still hit issue of comment21 on virtio-win-prewhql-199.
Z:\>mklink test1-link test1
symbolic link created for test1-link <<===>> test1

Z:\>mklink test2-link test2.txt
symbolic link created for test2-link <<===>> test2.txt

Z:\>mklink /d test1-link-d test1
symbolic link created for test1-link-d <<===>> test1

Z:\>mklink /d test2-link-d test2.txt
symbolic link created for test2-link-d <<===>> test2.txt

Z:\>
Z:\>
Z:\>
Z:\>dir
 Volume in drive Z is myfs_11
 Volume Serial Number is 0000-0000

 Directory of Z:\

01/01/1970  08:00 AM    <DIR>          .
01/01/1970  08:00 AM    <DIR>          ..
05/17/2021  09:21 AM    <DIR>          test1
05/17/2021  09:30 AM                 0 test1-link
05/17/2021  09:31 AM                 0 test1-link-d
05/17/2021  09:30 AM                 0 test2-link
05/17/2021  09:31 AM                 0 test2-link-d
05/17/2021  09:29 AM                 0 test2.txt
              10 File(s)        276,324 bytes
               5 Dir(s)  443,076,751,360 bytes free

Comment 27 Gal Hammer 2021-05-25 06:45:12 UTC
(In reply to xiagao from comment #25)
> Still hit issue of comment21 on virtio-win-prewhql-199.
> Z:\>mklink test1-link test1
> symbolic link created for test1-link <<===>> test1
> 
> Z:\>mklink test2-link test2.txt
> symbolic link created for test2-link <<===>> test2.txt
> 
> Z:\>mklink /d test1-link-d test1
> symbolic link created for test1-link-d <<===>> test1
> 
> Z:\>mklink /d test2-link-d test2.txt
> symbolic link created for test2-link-d <<===>> test2.txt
> 
> Z:\>
> Z:\>
> Z:\>
> Z:\>dir
>  Volume in drive Z is myfs_11
>  Volume Serial Number is 0000-0000
> 
>  Directory of Z:\
> 
> 01/01/1970  08:00 AM    <DIR>          .
> 01/01/1970  08:00 AM    <DIR>          ..
> 05/17/2021  09:21 AM    <DIR>          test1
> 05/17/2021  09:30 AM                 0 test1-link
> 05/17/2021  09:31 AM                 0 test1-link-d
> 05/17/2021  09:30 AM                 0 test2-link
> 05/17/2021  09:31 AM                 0 test2-link-d
> 05/17/2021  09:29 AM                 0 test2.txt
>               10 File(s)        276,324 bytes
>                5 Dir(s)  443,076,751,360 bytes free

It seem to be a limitation (or a bug?) of WinFSP. Can you please check if the Windows follows the symbolic links and ignore what "dir" shows you?

For example:

C:\>echo 1 > 1.txt

C:\>mklink 1-link.txt 1.txt
symbolic link created for 1-link.txt <<===>> 1.txt

C:\>type 1-link.txt
1

Comment 29 xiagao 2021-05-27 02:43:56 UTC
(In reply to Gal Hammer from comment #27)
> (In reply to xiagao from comment #25)
> > Still hit issue of comment21 on virtio-win-prewhql-199.
> > Z:\>mklink test1-link test1
> > symbolic link created for test1-link <<===>> test1
> > 
> > Z:\>mklink test2-link test2.txt
> > symbolic link created for test2-link <<===>> test2.txt
> > 
> > Z:\>mklink /d test1-link-d test1
> > symbolic link created for test1-link-d <<===>> test1
> > 
> > Z:\>mklink /d test2-link-d test2.txt
> > symbolic link created for test2-link-d <<===>> test2.txt
> > 
> > Z:\>
> > Z:\>
> > Z:\>
> > Z:\>dir
> >  Volume in drive Z is myfs_11
> >  Volume Serial Number is 0000-0000
> > 
> >  Directory of Z:\
> > 
> > 01/01/1970  08:00 AM    <DIR>          .
> > 01/01/1970  08:00 AM    <DIR>          ..
> > 05/17/2021  09:21 AM    <DIR>          test1
> > 05/17/2021  09:30 AM                 0 test1-link
> > 05/17/2021  09:31 AM                 0 test1-link-d
> > 05/17/2021  09:30 AM                 0 test2-link
> > 05/17/2021  09:31 AM                 0 test2-link-d
> > 05/17/2021  09:29 AM                 0 test2.txt
> >               10 File(s)        276,324 bytes
> >                5 Dir(s)  443,076,751,360 bytes free
> 
> It seem to be a limitation (or a bug?) of WinFSP. Can you please check if
> the Windows follows the symbolic links and ignore what "dir" shows you?
> 
> For example:
> 
> C:\>echo 1 > 1.txt
> 
> C:\>mklink 1-link.txt 1.txt
> symbolic link created for 1-link.txt <<===>> 1.txt
> 
> C:\>type 1-link.txt
> 1

Yes, virtio-fs mounted volume has the same behavior, the detailed info is below.
Z:\>echo 1 > 1.txt

Z:\>mklink 1-link.txt 1.txt
symbolic link created for 1-link.txt <<===>> 1.txt

Z:\>type 1-link.txt
1

Z:\>dir
 Volume in drive Z is myfs_11
 Volume Serial Number is 0000-0000

 Directory of Z:\

01/01/1970  08:00 AM    <DIR>          .
01/01/1970  08:00 AM    <DIR>          ..
05/27/2021  08:57 AM                 0 1-link.txt
05/27/2021  08:57 AM                 4 1.txt

Comment 31 xiagao 2021-06-04 03:41:53 UTC
(In reply to Gal Hammer from comment #27)
> (In reply to xiagao from comment #25)
> > Still hit issue of comment21 on virtio-win-prewhql-199.
> > Z:\>mklink test1-link test1
> > symbolic link created for test1-link <<===>> test1
> > 
> > Z:\>mklink test2-link test2.txt
> > symbolic link created for test2-link <<===>> test2.txt
> > 
> > Z:\>mklink /d test1-link-d test1
> > symbolic link created for test1-link-d <<===>> test1
> > 
> > Z:\>mklink /d test2-link-d test2.txt
> > symbolic link created for test2-link-d <<===>> test2.txt
> > 
> > Z:\>
> > Z:\>
> > Z:\>
> > Z:\>dir
> >  Volume in drive Z is myfs_11
> >  Volume Serial Number is 0000-0000
> > 
> >  Directory of Z:\
> > 
> > 01/01/1970  08:00 AM    <DIR>          .
> > 01/01/1970  08:00 AM    <DIR>          ..
> > 05/17/2021  09:21 AM    <DIR>          test1
> > 05/17/2021  09:30 AM                 0 test1-link
> > 05/17/2021  09:31 AM                 0 test1-link-d
> > 05/17/2021  09:30 AM                 0 test2-link
> > 05/17/2021  09:31 AM                 0 test2-link-d
> > 05/17/2021  09:29 AM                 0 test2.txt
> >               10 File(s)        276,324 bytes
> >                5 Dir(s)  443,076,751,360 bytes free
> 
> It seem to be a limitation (or a bug?) of WinFSP. Can you please check if
> the Windows follows the symbolic links and ignore what "dir" shows you?

Hi Gal,
The symbolic links works with virtio-win-prewhql-199, can we verify this bug?

And about "ignore what 'dir' show",could you handle it(where to note this behavior)?

Thanks,
Xiaoling


> 
> For example:
> 
> C:\>echo 1 > 1.txt
> 
> C:\>mklink 1-link.txt 1.txt
> symbolic link created for 1-link.txt <<===>> 1.txt
> 
> C:\>type 1-link.txt
> 1

Comment 32 xiagao 2021-06-08 09:56:49 UTC
Hi Gal, 
symbolic link only works for file not folder,for symbolic folder can't show the file in symbolic folder.
Do you want to support it in this release?  
Or I file two new bug to track folder issue and dir show issue?

Z:\>md test_folder2
Z:\>echo aaa > test_folder2\a
Z:\>mklink /d test_folder2-link test_folder2
symbolic link created for test_folder2-link <<===>> test_folder2

Z:\>dir
06/08/2021  05:25 PM    <DIR>          test_folder2
06/08/2021  05:31 PM                 0 test_folder2-link


Z:\test_folder2>dir
 Volume in drive Z is myfs_11
 Volume Serial Number is 0000-0000

 Directory of Z:\test_folder2

01/01/1970  08:00 AM    <DIR>          .
01/01/1970  08:00 AM    <DIR>          ..
06/08/2021  05:31 PM                 6 a
               1 File(s)              6 bytes
               2 Dir(s)  246,249,897,984 bytes free

Z:\test_folder2-link>dir
 Volume in drive Z is myfs_11
 Volume Serial Number is 0000-0000

 Directory of Z:\

==========================>should be Z:\test_folder2

06/08/2021  05:31 PM                 0 test_folder2-link
               1 File(s)              0 bytes
               0 Dir(s)  246,249,897,984 bytes free
==========================>should have file 'a'

Comment 33 Gal Hammer 2021-06-14 08:03:18 UTC
The results in comment #32 were based on a version which didn't include the symbolic links to directories fix. However another bug was found in the new version (type test_folder2-link\a) so another patch was posted (https://github.com/virtio-win/kvm-guest-drivers-windows/pull/587).

Comment 34 xiagao 2021-06-16 01:42:46 UTC
Test virtio-win-prewhql-202, type folder2-link\a.txt still failed.
guest: win2019


Z:\>md folder2

Z:\>echo test > folder2\a.txt

Z:\>type folder2\a.txt
test

Z:\>mklink /d folder2-link folder2
symbolic link created for folder2-link <<===>> folder2

Z:\>type folder2-link\a.txt
The system cannot find the file specified.

Comment 35 Vadim Rozenfeld 2021-06-16 01:52:04 UTC
The fix included into build 202
https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=1634715

Comment 36 xiagao 2021-06-17 01:57:44 UTC
According to comment 34, reassign this bz.

Comment 41 xiagao 2021-06-22 11:09:12 UTC
(In reply to xiagao from comment #34)
> Test virtio-win-prewhql-202, type folder2-link\a.txt still failed.
> guest: win2019
> 
> 
> Z:\>md folder2
> 
> Z:\>echo test > folder2\a.txt
> 
> Z:\>type folder2\a.txt
> test
> 
> Z:\>mklink /d folder2-link folder2
> symbolic link created for folder2-link <<===>> folder2
> 
> Z:\>type folder2-link\a.txt
> The system cannot find the file specified.


- Test with win2012 guest, hit the same issue with win2019
- Test win2016 guest with virtio-win-prewhql-202 version,when execute "Z:\>type folder2-link\a.txt" ,get another wrong error info below.
> Z:\>type folder2-link\a.txt
> The filename, directory name, or volume label syntax is incorrect.

Comment 44 xiagao 2021-07-02 09:52:07 UTC
Test virtio-win-prewhql-203, hit the following error.
Z:\>md folder

Z:\>echo test > folder\a.txt

Z:\>mklink /d folder-link folder
symbolic link created for folder-link <<===>> folder

Z:\>type folder\a.txt
test

Z:\>type folder-link\a.txt
The filename, directory name, or volume label syntax is incorrect.

===================>error info

Z:\>dir folder-link
 Volume in drive Z is myfs
 Volume Serial Number is 0000-0000

 Directory of Z:\

07/02/2021  05:48 PM                 0 folder-link
               1 File(s)              0 bytes
               0 Dir(s)  101,799,694,336 bytes free

Comment 45 xiagao 2021-07-13 08:38:54 UTC
virtio-win-prewhql-204 still has this issue.

Comment 50 Gal Hammer 2021-07-20 08:54:02 UTC
https://github.com/virtio-win/kvm-guest-drivers-windows/pull/604

Maybe this time:

Z:\>md folder

Z:\>echo test > folder\a.txt

Z:\>mklink /d folder-link folder
symbolic link created for folder-link <<===>> folder

Z:\>type folder\a.txt
test

Z:\>type folder-link\a.txt
test

Comment 51 xiagao 2021-08-03 07:33:56 UTC
Test pass with virtio-win-prewhql-205

windows os: Win10-32/64(21h1),win2012r2

Detailed steps:
Z:\>md folder

Z:\>echo test > folder\a.txt

Z:\>mklink /d folder-link folder
symbolic link created for folder-link <<===>> folder

Z:\>type folder-link\a.txt
test

Z:\>
Z:\>echo test > b.txt

Z:\>mklink b-link b.txt
symbolic link created for b-link <<===>> b.txt

Z:\>type b-link
test

So change status to verified.

Comment 56 errata-xmlrpc 2021-11-09 18:52:45 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/RHEA-2021:4341


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