diff options
author | Amir Goldstein <amir73il@gmail.com> | 2023-06-15 13:22:29 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2023-06-19 18:18:04 +0200 |
commit | bc2473c90fca55bf95b2ab6af1dacee26a4f92f6 (patch) | |
tree | c7932f522ec05e2fcc83e6b4b460abeb2e75a59e /fs/overlayfs/file.c | |
parent | fs: use backing_file container for internal files with "fake" f_path (diff) | |
download | linux-bc2473c90fca55bf95b2ab6af1dacee26a4f92f6.tar.xz linux-bc2473c90fca55bf95b2ab6af1dacee26a4f92f6.zip |
ovl: enable fsnotify events on underlying real files
Overlayfs creates the real underlying files with fake f_path, whose
f_inode is on the underlying fs and f_path on overlayfs.
Those real files were open with FMODE_NONOTIFY, because fsnotify code was
not prapared to handle fsnotify hooks on files with fake path correctly
and fanotify would report unexpected event->fd with fake overlayfs path,
when the underlying fs was being watched.
Teach fsnotify to handle events on the real files, and do not set real
files to FMODE_NONOTIFY to allow operations on real file (e.g. open,
access, modify, close) to generate async and permission events.
Because fsnotify does not have notifications on address space
operations, we do not need to worry about ->vm_file not reporting
events to a watched overlayfs when users are accessing a mapped
overlayfs file.
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Message-Id: <20230615112229.2143178-6-amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/overlayfs/file.c')
-rw-r--r-- | fs/overlayfs/file.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index 71fa6c83f093..dbbb156c2d67 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -34,8 +34,8 @@ static char ovl_whatisit(struct inode *inode, struct inode *realinode) return 'm'; } -/* No atime modification nor notify on underlying */ -#define OVL_OPEN_FLAGS (O_NOATIME | FMODE_NONOTIFY) +/* No atime modification on underlying */ +#define OVL_OPEN_FLAGS (O_NOATIME) static struct file *ovl_open_realfile(const struct file *file, const struct path *realpath) |