Access Time on cifs share

Issues related to configuring your network
Post Reply
lotte67890
Posts: 2
Joined: 2021/02/25 16:21:08

Access Time on cifs share

Post by lotte67890 » 2021/02/25 21:58:17

I have a CentOS 8 host where I´ve mounted a couple of cifs shares (Netapp FAS, and Windows Server 2016 shares).
What I want to achieve is to get the last “access time” for all the files on the shares with stat or find.
Unfortunately the access time is always equal to the c(hange)time and m(odification)time. When I look at the file with smbclient I can see the correct last ”access time”, also when I mount the Netapp share by nfs the access time is shown correct. The same behavior is seen with WSL (which uses Ubuntu).

Example from CentOS cifs:

Code: Select all

root@localhost cifs_path# stat L_Test-1.txt
  File: L_Test-1.txt
  Size: 51              Blocks: 1          IO Block: 1048576 regular file
Device: 60h/96d Inode: 17789497791182050313  Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-02-24 10:23:58.239296000 +0100
Modify: 2021-02-24 10:23:58.239296000 +0100
Change: 2021-02-24 10:23:58.239296000 +0100
Birth: -
Example from CentOS nfs:

Code: Select all

root@localhost nfs_path# stat L_Test-1.txt
  File: L_Test-1.txt
  Size: 51              Blocks: 0          IO Block: 65536  regular file
Device: 61h/97d Inode: 37897       Links: 1
Access: (0777/-rwxrwxrwx)  Uid: (    0/    root)   Gid: (    2/  daemon)
Access: 2021-02-25 18:34:13.918625000 +0100
Modify: 2021-02-24 10:23:58.239296000 +0100
Change: 2021-02-24 10:23:58.239296000 +0100
Birth: -
Smbclient shows:

Code: Select all

smbclient //1.2.3.4/test_vol 
Try "help" to get a list of possible commands.
smb: \> allinfo L_Test-1.txt
NT_STATUS_NOT_SUPPORTED getting alt name for \L_Test-1.txt
altname:
create_time:    Tue Feb 23 11:56:45 AM 2021 CET
access_time:    Thu Feb 25 06:34:14 PM 2021 CET
write_time:     Wed Feb 24 10:23:58 AM 2021 CET
change_time:    Wed Feb 24 10:23:58 AM 2021 CET
attributes: A (20)
stream: [::$DATA], 51 bytes
As I can see the access time is correctly stored on the share but I can´t get the proper value when mounted with mount.cifs.

The output of /proc/mounts:
//1.2.3.4/test_vol on /mnt/cifs_path type cifs (rw,relatime,vers=3.1.1,cache=strict,username=test,domain=test,uid=0,noforceuid,gid=0,noforcegid,addr=1.2.3.4,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=65536,wsize=65536,bsize=1048576,echo_interval=60,actimeo=1,user=test)

Installed cifs Version:

cifs-utils-6.8-3.el8.x86_64

Installed Samba Versions:

samba-4.11.2-13.el8.x86_64
samba-common-tools-4.11.2-13.el8.x86_64
pcp-pmda-samba-5.0.2-5.el8.x86_64
samba-client-4.11.2-13.el8.x86_64
samba-client-libs-4.11.2-13.el8.x86_64
samba-libs-4.11.2-13.el8.x86_64
samba-common-4.11.2-13.el8.noarch
samba-common-libs-4.11.2-13.el8.x86_64

CentOS Linux release 8.2.2004 (Core) Kernel 4.18.0-193.6.3.el8_2.x86_64

Does anybody has a hint how to get the proper access time when mounting the share via cifs?

Thanks in advance

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Access Time on cifs share

Post by TrevorH » 2021/02/26 10:31:12

Your first step is to yum update since you're still on 8.2 and 8.3 has been out for months and has a newer kernel with a newer cifs module.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

lotte67890
Posts: 2
Joined: 2021/02/25 16:21:08

Re: Access Time on cifs share

Post by lotte67890 » 2021/03/01 14:53:21

Well, thank you Trevor, 8.3 fixed the issue... Normally being carefully not updating a "running" system and not assuming that such bug could exist, I was unsure if that would help... It did...

Post Reply