NFS: update ctime for atime-only UTIME_NOW requests
Subsystems (2)
PATCH 1/1 NFS: update ctime for atime-only UTIME_NOW requests
When an NFS client holds a timestamp delegation, utimensat() with atime set to UTIME_NOW and mtime set to UTIME_OMIT reaches nfs_setattr() with ATTR_TIMES_SET but without ATTR_ATIME_SET.
There may be other paths that can reach here as well.
The delegated-atime fast path treats this as an implicit atime update, clears ATTR_ATIME and returns success without updating ctime.
Add check for ATTR_TIMES_SET along with ATTR_ATIME_SET (OR) so explicit timestamp requests use the normal SETATTR path while incidental atime updates can keep using the local shortcut.
Fixes e12912d94137 ("NFSv4: Add support for delegated atime and mtime attributes")
Signed-off-by Avi Weiss <[email protected]>
--- fs/nfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/inode.c +1 -1
@@ -740,7 +740,7 @@ nfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry, }else if (nfs_have_delegated_atime (inode) && attr->ia_valid &ATTR_ATIME && !(attr->ia_valid &ATTR_MTIME )) { -if (!(attr->ia_valid &ATTR_ATIME_SET )) { +if (!(attr->ia_valid & (ATTR_ATIME_SET |ATTR_TIMES_SET ))) {nfs_update_delegated_atime (inode); attr->ia_valid &= ~ATTR_ATIME ; }
base-commit: 32c52ec87d6245ee2d12ed5dd509e40062939b50
Signature · 1 line
2.43.0