Jeff Layton wrote:
I'm not sure this is actually fixable. The test seems to require that the atime not change on a read, but that's something that's more or less driven by the MDS, and it can't reasonably skip changing the atime just because the client happened to mount r/o. The MDS doesn't have any concept of a read-only mount (AFAIK).
The bottom line is that atime is a terrible fit for network filesystems like ceph (and really, atime was just a terrible idea anyway -- "Hey, let's turn every read operation into an inode write!").
Sorry I missed your last comment.
Currently the cephfs doesn't maintain the `atime`, more detail please see [1].
Currently the atime is flip-floping frequently:
The test for directory:
[root@lxbceph1 kcephfs]# mkdir dir
[root@lxbceph1 kcephfs]# stat dir
File: dir
Size: 0 Blocks: 0 IO Block: 65536 directory
Device: 32h/50d Inode: 1099511627777 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:cephfs_t:s0
Access: 2022-04-20 13:03:40.179479553 +0800
Modify: 2022-04-20 13:03:40.179479553 +0800
Change: 2022-04-20 13:03:40.179479553 +0800
Birth: 2022-04-20 13:03:40.179479553 +0800
[root@lxbceph1 kcephfs]# ls dir
[root@lxbceph1 kcephfs]# stat dir
File: dir
Size: 0 Blocks: 0 IO Block: 65536 directory
Device: 32h/50d Inode: 1099511627777 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:cephfs_t:s0
Access: 2022-04-20 13:03:47.159746159 +0800
Modify: 2022-04-20 13:03:40.179479553 +0800
Change: 2022-04-20 13:03:40.179479553 +0800
Birth: 2022-04-20 13:03:40.179479553 +0800
[root@lxbceph1 kcephfs]# mkdir dir/aa
[root@lxbceph1 kcephfs]# stat dir
File: dir
Size: 1 Blocks: 0 IO Block: 65536 directory
Device: 32h/50d Inode: 1099511627777 Links: 3
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:cephfs_t:s0
Access: 2022-04-20 13:03:47.159746159 +0800
Modify: 2022-04-20 13:03:55.432062116 +0800
Change: 2022-04-20 13:03:55.432062116 +0800
Birth: 2022-04-20 13:03:40.179479553 +0800
[root@lxbceph1 kcephfs]# ls dir
aa
[root@lxbceph1 kcephfs]# stat dir
File: dir
Size: 1 Blocks: 0 IO Block: 65536 directory
Device: 32h/50d Inode: 1099511627777 Links: 3
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:cephfs_t:s0
Access: 2022-04-20 13:03:40.179479553 +0800
Modify: 2022-04-20 13:03:55.432062116 +0800
Change: 2022-04-20 13:03:55.432062116 +0800
Birth: 2022-04-20 13:03:40.179479553 +0800
[root@lxbceph1 kcephfs]#
Same for the regular files. It will try to update the ctime in mmap and generic read cases and will ignore updating it in direct and sync read cases.
And even we update it in mmap and generic read cases we will drop it and won't sync it to MDS. And we are seeing the atime will be updated and then dropped to the floor again and again.
Sent a patch to disable the atime updating for the whole mount in [2].
[1] https://lists.ceph.io/hyperkitty/list/ceph-users@ceph.io/thread/VSJM7T4CS5TDRFF6XFPIYMHP75K73PZ6/
[2] https://patchwork.kernel.org/project/ceph-devel/list/?series=633625