* [PATCH] NFS: honor UTIME_NOW atime with explicit mtime
@ 2026-10-18 12:38 Avi Weiss
0 siblings, 0 replies; only message in thread
From: Avi Weiss @ 2026-10-18 12:38 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker
Cc: Sagi Grimberg, linux-nfs, linux-kernel, Avi Weiss
When utimensat() requests UTIME_NOW for atime and an explicit mtime,
the VFS sets ATTR_ATIME but not ATTR_ATIME_SET (as it should). The
delegated explicit-mtime path calls nfs_set_timestamps_to_ts(), which
skips atime, but nfs_setattr() then clears ATTR_ATIME, allowing the
syscall to succeed without updating atime.
The delegated explicit-mtime path already updates ctime locally.
The VFS also supplies the requested atime value in ia_atime,
even when ATTR_ATIME_SET is absent.
Check ATTR_ATIME instead of ATTR_ATIME_SET to also apply the
UTIME_NOW atime value supplied by the VFS.
Fixes: aba41e90aade ("NFSv4.2: fix setattr caching of TIME_[MODIFY|ACCESS]_SET when timestamps are delegated")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
Reproduced on 7.0.0-38-generic with an NFSv4.2 wa delegation:
utimensat() returned success but left atime unchanged.
Tested the fix on 7.3.0-rc7+ also with a wa delegation.
The same operation updated both atime and mtime correctly.
A kprobe confirmed nfs_setattr() received flags including:
ATTR_ATIME, ATTR_MTIME, ATTR_CTIME, ATTR_MTIME_SET and
ATTR_TIMES_SET; (0x10170) and returned 0.
fs/nfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 3022454f7698..4fa6c5547ab8 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -644,7 +644,7 @@ static void nfs_set_timestamps_to_ts(struct inode *inode, struct iattr *attr)
inode_maybe_inc_iversion(inode, updated);
cache_flags |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME;
}
- if (attr->ia_valid & ATTR_ATIME_SET) {
+ if (attr->ia_valid & ATTR_ATIME) {
inode_set_atime_to_ts(inode, attr->ia_atime);
cache_flags |= NFS_INO_INVALID_ATIME;
}
base-commit: 32c52ec87d6245ee2d12ed5dd509e40062939b50
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-18 12:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-18 12:38 [PATCH] NFS: honor UTIME_NOW atime with explicit mtime Avi Weiss
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®