summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-11-08 19:36:41 -0500
committerEric Paris <eparis@redhat.com>2010-11-29 14:51:24 -0500
commitd852c6baf825631e2560893acd5e04028cce0871 (patch)
tree3fc270300ceddf054705e4bf3d6b7093500d3cab /fs
parent546304f845657858244e72f98e853b145756c041 (diff)
fanotify: calculate the correct file flags up front
fanotify does and |= FMODE_NONOTIFY every single time it opens a file for the listeners. Instead just calculate that once during sys_fanotify_init() and use it when needed. Just a minor perf win. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/notify/fanotify/fanotify_user.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index f64d9f57426e..772a5dccc5cd 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -86,9 +86,7 @@ static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event)
* are NULL; That's fine, just don't call dentry open */
if (dentry && mnt) {
flags = group->fanotify_data.f_flags;
- new_file = dentry_open(dentry, mnt,
- flags | FMODE_NONOTIFY,
- current_cred());
+ new_file = dentry_open(dentry, mnt, flags, current_cred());
/*
* Attempt fallback to read-only access if writable was not possible
* in order to at least provide something to the listener.
@@ -96,8 +94,7 @@ static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event)
if (IS_ERR(new_file) && group->fanotify_data.readonly_fallback) {
flags &= ~O_ACCMODE;
flags |= O_RDONLY;
- new_file = dentry_open(dentry, mnt,
- flags | FMODE_NONOTIFY,
+ new_file = dentry_open(dentry, mnt, flags,
current_cred());
}
} else {
@@ -714,7 +711,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
group->fanotify_data.user = user;
atomic_inc(&user->fanotify_listeners);
- group->fanotify_data.f_flags = event_f_flags;
+ group->fanotify_data.f_flags = event_f_flags | FMODE_NONOTIFY;
#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
mutex_init(&group->fanotify_data.access_mutex);
init_waitqueue_head(&group->fanotify_data.access_waitq);