Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sshfs file reads setting ctime, mtime instead of atime #239

Closed
rasos opened this issue Jan 1, 2021 · 3 comments
Closed

sshfs file reads setting ctime, mtime instead of atime #239

rasos opened this issue Jan 1, 2021 · 3 comments

Comments

@rasos
Copy link

rasos commented Jan 1, 2021

We have observed timestamp changes when a backup process was reading sshfs mounted files. After analysing the situation with incrond and auditd we see that atime is never touched, but ctime and mtime are also touched sometimes when reading files. This makes a service like nextcloud generating conflicted copies situations, as it thinks files have been changed.

Steps to reproduce

less /mnt/storage_sshfs/timestampTEST.txt  
ls -al /mnt/storage_sshfs/timestampTEST.txt 
-rwxr--r-- 1 www-data www-data   33 Dec 31 18:31 timestampTEST.txt

ausearch -f /mnt/storage_sshfs/timestampTEST.txt
----
time->Thu Dec 31 18:31:57 2020
type=PROCTITLE msg=audit(1609435917.669:108): proctitle=6C657373002F6D6E742F73746F72616765626F782F66616972636C6F75645F73736866732F74696D657374616D70544553542E747874
type=PATH msg=audit(1609435917.669:108): item=0 name="/mnt/storage_sshfs/timestampTEST.txt" inode=1512637 dev=00:37 mode=0100744 ouid=33 ogid=33 rdev=00:00 nametype=NORMAL cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0
type=CWD msg=audit(1609435917.669:108): cwd="/mnt/storage_sshfs"
type=SYSCALL msg=audit(1609435917.669:108): arch=40000003 syscall=295 success=yes exit=4 a0=ffffff9c a1=b86b70 a2=8000 a3=0 items=1 ppid=24140 pid=20098 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=31731 comm="less" exe="/bin/less" key="sshfs-timestamp-test"

stat /mnt/storage_sshfs/timestampTEST.txt
  File: /mnt/storage_sshfs/timestampTEST.txt
  Size: 33        	Blocks: 8          IO Block: 4096   regular file
Device: 37h/55d	Inode: 1512637     Links: 1
Access: (0744/-rwxr--r--)  Uid: (   33/www-data)   Gid: (   33/www-data)
Access: 2020-12-19 22:33:06.000000000 +0100
Modify: 2020-12-31 18:31:59.000000000 +0100
Change: 2020-12-31 18:31:59.000000000 +0100
 Birth: -

A less command does not always change mtime+ctime, only after some days, so that may be related to caching. But when it changes the timestamp, it is definetely the wrong one.

sshfs is mounted on Ubuntu 18.04 server with kernel is 4.15.0-128-generic #131-Ubuntu i686 32bit as

[email protected]: /mnt/storage_sshfs fuse.sshfs defaults,allow_other,uid=33,gid=33,port=23,reconnect,ServerAliveInterval=30,ServerAliveCountMax=10,auto_cache,cache_timeout=115200,attr_timeout=115200,_netdev 0 0

May be related to #44, #93.

@rasos
Copy link
Author

rasos commented Jan 5, 2021

Here is a similar bug affecting CIFS/SMB https://bugzilla.kernel.org/show_bug.cgi?id=198967 affecting kernel version 4.15.

@Nikratio
Copy link
Contributor

Thanks for the report! SSHFS itself does not update any timestamps, it forwards requests to the remote SSH server and forwards that the times that this server reports. So I'm afraid that whatever happens here, SSHFS can't influence it...

@Nikratio
Copy link
Contributor

Closing this for now, since there seems to be nothing that we can change in SSHFS to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants