aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2025-11-20 07:47:23 +0100
committerChristian Brauner <brauner@kernel.org>2025-11-26 14:50:10 +0100
commit7f30e7a42371af4bba53f9a875a0d320cead9f4b (patch)
tree9696c5369106c763a4e127da819eb56ae5f4a335 /fs/inode.c
parent3cd9a42f1b5e34d3972237cbf8541af60844cbd4 (diff)
downloadrandom-7f30e7a42371af4bba53f9a875a0d320cead9f4b.tar.gz
fs: lift the FMODE_NOCMTIME check into file_update_time_flags
FMODE_NOCMTIME used to be just a hack for the legacy XFS handle-based "invisible I/O", but commit e5e9b24ab8fa ("nfsd: freeze c/mtime updates with outstanding WRITE_ATTRS delegation") started using it from generic callers. I'm not sure other file systems are actually read for this in general, so the above commit should get a closer look, but for it to make any sense, file_update_time needs to respect the flag. Lift the check from file_modified_flags to file_update_time so that users of file_update_time inherit the behavior and so that all the checks are done in one place. Fixes: e5e9b24ab8fa ("nfsd: freeze c/mtime updates with outstanding WRITE_ATTRS delegation") Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20251120064859.2911749-3-hch@lst.de Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 4884ffa931e7bc..24dab63844dbef 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2320,6 +2320,8 @@ static int file_update_time_flags(struct file *file, unsigned int flags)
/* First try to exhaust all avenues to not sync */
if (IS_NOCMTIME(inode))
return 0;
+ if (unlikely(file->f_mode & FMODE_NOCMTIME))
+ return 0;
now = current_time(inode);
@@ -2391,8 +2393,6 @@ static int file_modified_flags(struct file *file, int flags)
ret = file_remove_privs_flags(file, flags);
if (ret)
return ret;
- if (unlikely(file->f_mode & FMODE_NOCMTIME))
- return 0;
return file_update_time_flags(file, flags);
}