Bug 14476 - Cannot set timestamp of Minshall-French symlinks from a CIFS mount
Summary: Cannot set timestamp of Minshall-French symlinks from a CIFS mount
Status: ASSIGNED
Alias: None
Product: CifsVFS
Classification: Unclassified
Component: kernel fs (show other bugs)
Version: 5.x
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Steve French
QA Contact: cifs QA contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-01 22:00 UTC by Micah Veilleux
Modified: 2023-10-14 16:17 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Micah Veilleux 2020-09-01 22:00:24 UTC
I see that it is possible to act on a Minshall-French symlink to change the timestamp of its target:
------------------------------
mcrs3:/TCS # ls -lh test*
-rwxr-xr-x 1 root root 0 Sep  1 00:13 testfile
lrwxrwxrwx 1 root root 8 Sep  1 00:13 testlink -> testfile
mcrs3:/TCS #
mcrs3:/TCS # touch -t 01011200 testlink
mcrs3:/TCS #
mcrs3:/TCS # ls -lh test*
-rwxr-xr-x 1 root root 0 Jan  1  2020 testfile                # January expected --> ok
lrwxrwxrwx 1 root root 8 Sep  1 00:13 testlink -> testfile
------------------------------

But the "-h" option of "touch" does not work to trigger a change to the timestamp of the mfsymlink itself.  Neither the mfsymlink nor its target gets the specified timestamp:
------------------------------
mcrs3:/TCS # touch -h -t 02011200 testlink
mcrs3:/TCS #
mcrs3:/TCS # ls -lh test*
-rwxr-xr-x 1 root root 0 Jan  1  2020 testfile
lrwxrwxrwx 1 root root 8 Sep  1 00:13 testlink -> testfile    # February expected --> not ok
mcrs3:/TCS #
------------------------------

When I use the "-h" option against a regular file, it does get the specified timestamp:
------------------------------
mcrs3:/TCS # touch -h -t 02011200 testfile
mcrs3:/TCS #
mcrs3:/TCS # ls -lh test*
-rwxr-xr-x 1 root root 0 Feb  1  2020 testfile                # February expected --> ok
lrwxrwxrwx 1 root root 8 Sep  1 00:13 testlink -> testfile
mcrs3:/TCS #
------------------------------

Details of the mount, and versions:
------------------------------
mcrs3:/TCS # grep "TCS " /etc/fstab
//mcrs3/TCS /TCS cifs user=cifsuser,multiuser,domain=VPTC3,sec=krb5,mfsymlinks,vers=3.0 0 0
mcrs3:/TCS #
mcrs3:/TCS # mount.cifs --version
mount.cifs version: 6.5
mcrs3:/TCS #
mcrs3:/TCS # head -n 2 /etc/os-release
NAME="SLES"
VERSION="15"
mcrs3:/TCS #
------------------------------

Minshall-French symlinks are not "standard" symlinks, so maybe it's to be expected that standard linux utilities cannot manage them properly, but perhaps it is possible for Samba to address this.
Comment 1 Björn Jacke 2020-09-04 11:02:17 UTC
moving this to the cifsvfs product because the Minshall-French symlink are a client-only thing.
Comment 2 Steve French 2023-10-13 22:04:51 UTC
David Howells spotted the problem - cifs.ko is missing setattr in the cifs_symlink_inode_operations
Comment 3 Steve French 2023-10-14 16:17:43 UTC
This change fixes it:

diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index 22869cda1356..ea3a7a668b45 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -1191,6 +1191,7 @@ const char *cifs_get_link(struct dentry *dentry, struct inode *inode,
 
 const struct inode_operations cifs_symlink_inode_ops = {
        .get_link = cifs_get_link,
+       .setattr = cifs_setattr,
        .permission = cifs_permission,
        .listxattr = cifs_listxattr,
 };