aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/file_table.c
diff options
context:
space:
mode:
authorLeon Romanovsky <leon@kernel.org>2025-02-25 04:04:46 -0500
committerLeon Romanovsky <leon@kernel.org>2025-02-25 04:04:46 -0500
commit230804a89319a76c6e653caadc98a870877548cc (patch)
tree27113d25cebb6a5c868e7c35a29809921223f86f /fs/file_table.c
parentRDMA/hfi1: Remove unused one_qsfp_write (diff)
parentnet/mlx5: Change POOL_NEXT_SIZE define value and make it global (diff)
downloadwireguard-linux-230804a89319a76c6e653caadc98a870877548cc.tar.xz
wireguard-linux-230804a89319a76c6e653caadc98a870877548cc.zip
Merge branch 'mlx5-next' into wip/leon-for-next
This is merge of shared branch between RDMA and net-next trees. * mlx5-next: (550 commits) net/mlx5: Change POOL_NEXT_SIZE define value and make it global net/mlx5: Add new health syndrome error and crr bit offset Linux 6.14-rc3 ... Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to '')
-rw-r--r--fs/file_table.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index f0291a66f9db..5c00dc38558d 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -194,6 +194,11 @@ static int init_file(struct file *f, int flags, const struct cred *cred)
* refcount bumps we should reinitialize the reused file first.
*/
file_ref_init(&f->f_ref, 1);
+ /*
+ * Disable permission and pre-content events for all files by default.
+ * They may be enabled later by file_set_fsnotify_mode_from_watchers().
+ */
+ file_set_fsnotify_mode(f, FMODE_NONOTIFY_PERM);
return 0;
}
@@ -375,7 +380,13 @@ struct file *alloc_file_pseudo(struct inode *inode, struct vfsmount *mnt,
if (IS_ERR(file)) {
ihold(inode);
path_put(&path);
+ return file;
}
+ /*
+ * Disable all fsnotify events for pseudo files by default.
+ * They may be enabled by caller with file_set_fsnotify_mode().
+ */
+ file_set_fsnotify_mode(file, FMODE_NONOTIFY);
return file;
}
EXPORT_SYMBOL(alloc_file_pseudo);
@@ -400,6 +411,11 @@ struct file *alloc_file_pseudo_noaccount(struct inode *inode,
return file;
}
file_init_path(file, &path, fops);
+ /*
+ * Disable all fsnotify events for pseudo files by default.
+ * They may be enabled by caller with file_set_fsnotify_mode().
+ */
+ file_set_fsnotify_mode(file, FMODE_NONOTIFY);
return file;
}
EXPORT_SYMBOL_GPL(alloc_file_pseudo_noaccount);