]> git.hungrycats.org Git - linux/commit
btrfs: honor FMODE_NOCMTIME in btrfs_write_check()
authorJeff Layton <jlayton@kernel.org>
Thu, 5 Nov 2026 20:07:42 +0000 (15:07 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Mon, 9 Nov 2026 00:28:32 +0000 (19:28 -0500)
commit23d07ee01743d6188ef4a579903d40aab2f1ff6b
treee2d41d327097334311f798da816d165c6fe469df
parentd50d994bffa3c7c6db2d8bc4c5f0c55e3f46b0cd
btrfs: honor FMODE_NOCMTIME in btrfs_write_check()

btrfs_write_check() open-codes the c/mtime update and checks only
IS_NOCMTIME(inode). file_update_time() also skips the update when the
file has FMODE_NOCMTIME. nfsd sets this flag on files that have a
delegation with delegated timestamps.

Thus, on a btrfs export, WRITEs from the delegation holder update the
server's c/mtime. When the holder returns its times, nfsd restores the
mtime. nfsd cannot move ctime backward, so ctime stays newer than the
time that the holder reported. Over NFSv4.2, git test t1092 finds a
stat-dirty file.

Skip the update for FMODE_NOCMTIME files too.

Fixes: e5e9b24ab8fa ("nfsd: freeze c/mtime updates with outstanding WRITE_ATTRS delegation")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20261105-delegts-btrfs-v1-1-a42a2b93cdc2@kernel.org
fs/btrfs/file.c