summaryrefslogtreecommitdiff
path: root/fs/open.c
diff options
context:
space:
mode:
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 4478adcc4f3a..005ca91a173b 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -969,6 +969,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:
@@ -1358,7 +1363,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);
}
}