diff options
author | Amir Goldstein <amir73il@gmail.com> | 2023-06-11 15:24:29 +0300 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2023-06-12 10:43:45 +0200 |
commit | 7b8c9d7bb4570ee4800642009c8f2d9756004552 (patch) | |
tree | 807f50d866296846244e9cc88196c6dbd7e72022 /fs/fhandle.c | |
parent | 7cdafe6cc4a6ee94c56a5c96d6edd80d066d5a3b (diff) | |
download | linux-stable-7b8c9d7bb4570ee4800642009c8f2d9756004552.tar.gz linux-stable-7b8c9d7bb4570ee4800642009c8f2d9756004552.tar.bz2 linux-stable-7b8c9d7bb4570ee4800642009c8f2d9756004552.zip |
fsnotify: move fsnotify_open() hook into do_dentry_open()
fsnotify_open() hook is called only from high level system calls
context and not called for the very many helpers to open files.
This may makes sense for many of the special file open cases, but it is
inconsistent with fsnotify_close() hook that is called for every last
fput() of on a file object with FMODE_OPENED.
As a result, it is possible to observe ACCESS, MODIFY and CLOSE events
without ever observing an OPEN event.
Fix this inconsistency by replacing all the fsnotify_open() hooks with
a single hook inside do_dentry_open().
If there are special cases that would like to opt-out of the possible
overhead of fsnotify() call in fsnotify_open(), they would probably also
want to avoid the overhead of fsnotify() call in the rest of the fsnotify
hooks, so they should be opening that file with the __FMODE_NONOTIFY flag.
However, in the majority of those cases, the s_fsnotify_connectors
optimization in fsnotify_parent() would be sufficient to avoid the
overhead of fsnotify() call anyway.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Message-Id: <20230611122429.1499617-1-amir73il@gmail.com>
Diffstat (limited to 'fs/fhandle.c')
-rw-r--r-- | fs/fhandle.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/fs/fhandle.c b/fs/fhandle.c index fd0d6a3b3699..6ea8d35a9382 100644 --- a/fs/fhandle.c +++ b/fs/fhandle.c @@ -242,7 +242,6 @@ static long do_handle_open(int mountdirfd, struct file_handle __user *ufh, retval = PTR_ERR(file); } else { retval = fd; - fsnotify_open(file); fd_install(fd, file); } path_put(&path); |