summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2025-07-08 17:36:40 +0300
committerJan Kara <jack@suse.cz>2025-07-28 19:14:38 +0300
commit08da98e1b2f76cdbacf84b9affaa75960dbce515 (patch)
treedf25e6a4bfa465c8a16f589452611e33d330a52f /include/linux
parent3193e8942fc7f70ba3c872a988a0c15f98818bd2 (diff)
downloadlinux-08da98e1b2f76cdbacf84b9affaa75960dbce515.tar.xz
fsnotify: merge file_set_fsnotify_mode_from_watchers() with open perm hook
Create helper fsnotify_open_perm_and_set_mode() that moves the fsnotify_open_perm() hook into file_set_fsnotify_mode_from_watchers(). This will allow some more optimizations. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20250708143641.418603-2-amir73il@gmail.com
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fsnotify.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 454d8e466958..8c1fa617d375 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -129,7 +129,7 @@ static inline int fsnotify_file(struct file *file, __u32 mask)
#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
-void file_set_fsnotify_mode_from_watchers(struct file *file);
+int fsnotify_open_perm_and_set_mode(struct file *file);
/*
* fsnotify_file_area_perm - permission hook before access to file range
@@ -215,9 +215,6 @@ static inline int fsnotify_open_perm(struct file *file)
{
int ret;
- if (likely(!FMODE_FSNOTIFY_PERM(file->f_mode)))
- return 0;
-
if (file->f_flags & __FMODE_EXEC) {
ret = fsnotify_path(&file->f_path, FS_OPEN_EXEC_PERM);
if (ret)
@@ -228,8 +225,9 @@ static inline int fsnotify_open_perm(struct file *file)
}
#else
-static inline void file_set_fsnotify_mode_from_watchers(struct file *file)
+static inline int fsnotify_open_perm_and_set_mode(struct file *file)
{
+ return 0;
}
static inline int fsnotify_file_area_perm(struct file *file, int perm_mask,