]> git.hungrycats.org Git - linux/commit
btrfs: honor FMODE_NOCMTIME when cloning 7.3/topics/nocmtime
authorJeff Layton <jlayton@kernel.org>
Thu, 5 Nov 2026 20:07:45 +0000 (15:07 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Mon, 9 Nov 2026 00:28:35 +0000 (19:28 -0500)
commitc7d628fe9a484becdbecaf84038cb2f7d0a16863
treea0bf765460e48cc731da37f821f1cdd827b98f38
parentc98e791fd660086fa1bd0bc224471002282567ea
btrfs: honor FMODE_NOCMTIME when cloning

btrfs_remap_file_range() calls generic_remap_file_range_prep() through
btrfs_remap_file_range_prep(). The file_modified() call in
generic_remap_file_range_prep() skips the c/mtime update for
FMODE_NOCMTIME files, but btrfs_clone_files() then always tells
btrfs_clone() to update the c/mtime of the destination.

nfsd sets FMODE_NOCMTIME while a client holds delegated timestamps. Thus
a CLONE from the holder advances the server's ctime, and the times that
the holder returns cannot move it back.

Pass no_time_update for FMODE_NOCMTIME destinations, as dedupe already
does. Make btrfs_should_update_cmtime() available to reflink.c.

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-4-a42a2b93cdc2@kernel.org
fs/btrfs/file.c
fs/btrfs/file.h
fs/btrfs/reflink.c