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 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);
}
}