summaryrefslogtreecommitdiff
path: root/fs/open.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-06-29 13:31:44 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2023-06-29 13:31:44 -0700
commit18c9901d7435b20b13357907bac2c0e3b0fd4cd6 (patch)
treeea136473471c0a7864e8b65451e803be2d577830 /fs/open.c
parent0a37714f96d5746268dc09bdd400a215f180ba9b (diff)
parent7b8c9d7bb4570ee4800642009c8f2d9756004552 (diff)
Merge tag 'fsnotify_for_v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull fsnotify updates from Jan Kara: - Support for fanotify events returning file handles for filesystems not exportable via NFS - Improved error handling exportfs functions - Add missing FS_OPEN events when unusual open helpers are used * tag 'fsnotify_for_v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: fsnotify: move fsnotify_open() hook into do_dentry_open() exportfs: check for error return value from exportfs_encode_*() fanotify: support reporting non-decodeable file handles exportfs: allow exporting non-decodeable file handles to userspace exportfs: add explicit flag to request non-decodeable file handles exportfs: change connectable argument to bit flags
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/open.c b/fs/open.c
index fb07b2840eb4..0c55c8e7f837 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -963,6 +963,11 @@ static int do_dentry_open(struct file *f,
}
}
+ /*
+ * Once we return a file with FMODE_OPENED, __fput() will call
+ * fsnotify_close(), so we need fsnotify_open() here for symmetry.
+ */
+ fsnotify_open(f);
return 0;
cleanup_all:
@@ -1404,7 +1409,6 @@ static long do_sys_openat2(int dfd, const char __user *filename,
put_unused_fd(fd);
fd = PTR_ERR(f);
} else {
- fsnotify_open(f);
fd_install(fd, f);
}
}