[LU-3831] ll_readdir() ignores O_NOATIME Created: 23/Aug/13  Updated: 06/Apr/15  Resolved: 09/Mar/14

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.5.0
Fix Version/s: Lustre 2.6.0

Type: Bug Priority: Major
Reporter: John Hammond Assignee: John Hammond
Resolution: Fixed Votes: 0
Labels: llite, patch

Issue Links:
Duplicate
duplicates LU-3315 O_NOATIME: don't change access time a... Resolved
is duplicated by LU-4632 don't touch atime in ll_readdir Resolved
Severity: 3
Rank (Obsolete): 9899

 Description   

ll_readdir calls touch_atime() which is wrong because it ignores
whether O_NOATIME is set in f_flags. On RHEL 6, this is moreover unnecessary as vfs_readdir() calls file_accessed() (which does check for O_NOATIME) after invoking f_op->readdir().



 Comments   
Comment by Andreas Dilger [ 23/Aug/13 ]

There is likely a historical reason for this (i.e. it wasn't done in some 2.4.9 kernel), but was moved into the VFS and nobody noticed. Sounds like this call can just be deleted.

It is also worthwhile to check if the MDS code handles "-o noatime" or "-o relatime" properly or not. It might be that the MDS writes the atime sent from the client even if it is mounted with "-o noatime".

Comment by John Hammond [ 23/Aug/13 ]

O_NOATIME is broken in several places. I'm preparing to report that issue but didn't want to forget this one. Will investigate '-o noatime' after this. Not sure about how it's handled on-disk but I feel confident that from the client POV it will appear to be broken.

Comment by John Hammond [ 23/Aug/13 ]

Despite ll_readdir() ignoring O_NATIME, directory access timestamps are not updated from userspace's POV.

# mkdir /mnt/lustre/d0
# stat /mnt/lustre/d0
  File: `/mnt/lustre/d0'
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: 2c54f966h/743766374d	Inode: 144115205255725058  Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-08-23 13:51:06.000000000 -0500
Modify: 2013-08-23 13:51:06.000000000 -0500
Change: 2013-08-23 13:51:06.000000000 -0500
# /bin/ls /mnt/lustre/d0
# stat /mnt/lustre/d0
  File: `/mnt/lustre/d0'
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: 2c54f966h/743766374d	Inode: 144115205255725058  Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-08-23 13:51:06.000000000 -0500
Modify: 2013-08-23 13:51:06.000000000 -0500
Change: 2013-08-23 13:51:06.000000000 -0500
# date 
Fri Aug 23 13:52:10 CDT 2013
# /bin/ls /mnt/lustre/d0
# stat /mnt/lustre/d0
  File: `/mnt/lustre/d0'
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: 2c54f966h/743766374d	Inode: 144115205255725058  Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-08-23 13:51:06.000000000 -0500
Modify: 2013-08-23 13:51:06.000000000 -0500
Change: 2013-08-23 13:51:06.000000000 -0500
Comment by Swapnil Pimpale (Inactive) [ 26/Dec/13 ]

Patch: http://review.whamcloud.com/#/c/8664/

I used the recently added file_is_noatime() to honor O_NOATIME before calling touch_atime in ll_readdir()

Comment by John Hammond [ 09/Mar/14 ]

Patch landed to master. Thanks Swapnil.

Comment by Gerrit Updater [ 09/Feb/15 ]

Faccini Bruno (bruno.faccini@intel.com) uploaded a new patch: http://review.whamcloud.com/13687
Subject: LU-3831 llite: Remove touch_atime() call in ll_readdir()
Project: fs/lustre-release
Branch: b2_5
Current Patch Set: 1
Commit: e6105f668ec9135f1c888399329f4d8fd5b68cde

Comment by Bruno Faccini (Inactive) [ 09/Feb/15 ]

b2_5 patch version/back-port is at http://review.whamcloud.com/13687/.

Generated at Sat Feb 10 01:37:16 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.