diff options
author | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:37 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:50 -0400 |
commit | 80af2588676483ac4e998b5092e9d008dab3ab62 (patch) | |
tree | 6bff012a185f55b27f601e50b2f2ad53e9fc9f63 /fs | |
parent | 20dee624ca40db227aa70cb3f44d2d6cb4fdbab4 (diff) |
fanotify: groups can specify their f_flags for new fd
Currently fanotify fds opened for thier listeners are done with f_flags
equal to O_RDONLY | O_LARGEFILE. This patch instead takes f_flags from the
fanotify_init syscall and uses those when opening files in the context of
the listener.
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/notify/fanotify/fanotify_user.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index da01091f93eb..7182c83be90e 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c | |||
@@ -81,7 +81,7 @@ static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event) | |||
81 | * are NULL; That's fine, just don't call dentry open */ | 81 | * are NULL; That's fine, just don't call dentry open */ |
82 | if (dentry && mnt) | 82 | if (dentry && mnt) |
83 | new_file = dentry_open(dentry, mnt, | 83 | new_file = dentry_open(dentry, mnt, |
84 | O_RDONLY | O_LARGEFILE | FMODE_NONOTIFY, | 84 | group->fanotify_data.f_flags | FMODE_NONOTIFY, |
85 | current_cred()); | 85 | current_cred()); |
86 | else | 86 | else |
87 | new_file = ERR_PTR(-EOVERFLOW); | 87 | new_file = ERR_PTR(-EOVERFLOW); |
@@ -625,9 +625,6 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) | |||
625 | pr_debug("%s: flags=%d event_f_flags=%d\n", | 625 | pr_debug("%s: flags=%d event_f_flags=%d\n", |
626 | __func__, flags, event_f_flags); | 626 | __func__, flags, event_f_flags); |
627 | 627 | ||
628 | if (event_f_flags) | ||
629 | return -EINVAL; | ||
630 | |||
631 | if (!capable(CAP_SYS_ADMIN)) | 628 | if (!capable(CAP_SYS_ADMIN)) |
632 | return -EACCES; | 629 | return -EACCES; |
633 | 630 | ||
@@ -645,6 +642,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) | |||
645 | if (IS_ERR(group)) | 642 | if (IS_ERR(group)) |
646 | return PTR_ERR(group); | 643 | return PTR_ERR(group); |
647 | 644 | ||
645 | group->fanotify_data.f_flags = event_f_flags; | ||
648 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 646 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |
649 | mutex_init(&group->fanotify_data.access_mutex); | 647 | mutex_init(&group->fanotify_data.access_mutex); |
650 | init_waitqueue_head(&group->fanotify_data.access_waitq); | 648 | init_waitqueue_head(&group->fanotify_data.access_waitq); |