Bug 10883 - Samba server does not update ctime (SMB or SMB3 last change time) on hardlinks
Summary: Samba server does not update ctime (SMB or SMB3 last change time) on hardlinks
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.2.0rc2
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-17 21:57 UTC by Steve French
Modified: 2024-01-07 12:59 UTC (History)
1 user (show)

See Also:


Attachments
wireshark trace showing samba not updating change time on hardlinks but showing windows is updating change time (16.22 KB, application/x-pcapng)
2014-10-17 22:02 UTC, Steve French
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve French 2014-10-17 21:57:44 UTC
Samba does not update ctime (last Change time) on either CIFS or SMB3 when creating a hard link while Windows servers do (and obviously Linux local file systems too).  It works with POSIX Extensions but not with CIFS or SMB3 to Samba. Following is output from a simple demonstration (/mnt is a cifs mount to Samba, /mnt1 is a cifs mount to Windows 8.1).

root@ubuntu:~/cifs-2.6# touch /mnt/file1
root@ubuntu:~/cifs-2.6# touch /mnt1/file1
root@ubuntu:~/cifs-2.6# stat /mnt/file1 ; ln /mnt/file1 /mnt/file2
  File: ‘/mnt/file1’
  Size: 0         	Blocks: 0          IO Block: 16384  regular empty file
Device: 1dh/29d	Inode: 395051      Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-10-17 16:33:59.538897300 -0500
Modify: 2014-10-17 16:33:59.538897300 -0500
Change: 2014-10-17 16:33:59.538897300 -0500
 Birth: -
root@ubuntu:~/cifs-2.6# stat /mnt/file2
  File: ‘/mnt/file2’
  Size: 0         	Blocks: 0          IO Block: 16384  regular empty file
Device: 1dh/29d	Inode: 395051      Links: 2
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-10-17 16:33:59.538897300 -0500
Modify: 2014-10-17 16:33:59.538897300 -0500
Change: 2014-10-17 16:33:59.538897300 -0500
 Birth: -

/* NOTE ctime HAS NOT CHANGED LIKE IT SHOULD */

/* Now repeat experiment to Windows 8.1 */

root@ubuntu:~/cifs-2.6# stat /mnt1/file1 ; ln /mnt1/file1 /mnt1/file2
  File: ‘/mnt1/file1’
  Size: 0         	Blocks: 0          IO Block: 16384  regular empty file
Device: 1eh/30d	Inode: 2251799813699648  Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-10-17 16:34:02.982897300 -0500
Modify: 2014-10-17 16:34:02.982897300 -0500
Change: 2014-10-17 16:34:02.982897300 -0500
 Birth: -
root@ubuntu:~/cifs-2.6# stat /mnt1/file2
  File: ‘/mnt1/file2’
  Size: 0         	Blocks: 0          IO Block: 16384  regular empty file
Device: 1eh/30d	Inode: 2251799813699648  Links: 2
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-10-17 16:34:02.982897300 -0500
Modify: 2014-10-17 16:34:02.982897300 -0500
Change: 2014-10-17 16:38:28.726949400 -0500  /* NOTE ctime HAS CHANGED */
 Birth: -
Comment 1 Steve French 2014-10-17 22:02:28 UTC
Created attachment 10355 [details]
wireshark trace showing samba not updating change time on hardlinks but showing windows is updating change time

127.0.0.1 target is samba server (4.1 server, but also fails to 4.2-rc2)
(note 


192.168.93.159 target is Windows 8.1 server

Compare frame 45 (bad change time) to frame 83 (change time updated)
Comment 2 Steve French 2014-10-17 22:03:41 UTC
Note that this was discovered with xfstests generic/236 running on SMB3 Linux mount
Comment 3 Anubhav Rakshit 2015-07-08 09:37:19 UTC
Looks like this is XFS specific. Hardlink creation and updation of ctime works fine with ext4 for me.

====
anubhav@citadel:~$ stat notes.txt
  File: `notes.txt'
  Size: 11456           Blocks: 24         IO Block: 4096   regular file
Device: 801h/2049d      Inode: 9706103     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/ anubhav)   Gid: ( 1000/ anubhav)
Access: 2015-06-18 17:08:18.655020928 +0530
Modify: 2014-06-25 20:09:58.594835586 +0530
Change: 2014-06-25 20:09:58.648784072 +0530

smb: \> hardlink notes.txt notes1.txt

anubhav@citadel:~$ stat notes1.txt
  File: `notes1.txt'
  Size: 11456           Blocks: 24         IO Block: 4096   regular file
Device: 801h/2049d      Inode: 9706103     Links: 2
Access: (0644/-rw-r--r--)  Uid: ( 1000/ anubhav)   Gid: ( 1000/ anubhav)
Access: 2015-06-18 17:08:18.655020928 +0530
Modify: 2014-06-25 20:09:58.594835586 +0530
Change: 2015-07-08 14:59:03.383769118 +0530

anubhav@citadel:~$ sudo blkid /dev/sda1 
/dev/sda1: UUID="16a10327-c4ba-4a36-866d-d67a775fcb57" TYPE="ext4"

anubhav@citadel:~$ /usr/local/samba/sbin/smbd -V
Version 4.3.0pre1-GIT-e3373e9
====