aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-10-28 17:21:57 -0400
committerEric Paris <eparis@redhat.com>2010-10-28 17:22:14 -0400
commit5dd03f55fd2f21916ce248bb2e68bbfb39d94fe5 (patch)
tree3d4446ce07126b9983849a41670542c69bb400bd /fs
parent2529a0df0f64dab1f60ae08e038b89c53a6b4c02 (diff)
fanotify: allow userspace to override max queue depth
fanotify has a defualt max queue depth. This patch allows processes which explicitly request it to have an 'unlimited' queue depth. These processes need to be very careful to make sure they cannot fall far enough behind that they OOM the box. Thus this flag is gated on CAP_SYS_ADMIN. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/notify/fanotify/fanotify_user.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 04f2fe47b66a..43d66d9b2eff 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -691,7 +691,14 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
691 goto out_put_group; 691 goto out_put_group;
692 } 692 }
693 693
694 group->max_events = FANOTIFY_DEFAULT_MAX_EVENTS; 694 if (flags & FAN_UNLIMITED_QUEUE) {
695 fd = -EPERM;
696 if (!capable(CAP_SYS_ADMIN))
697 goto out_put_group;
698 group->max_events = UINT_MAX;
699 } else {
700 group->max_events = FANOTIFY_DEFAULT_MAX_EVENTS;
701 }
695 702
696 fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags); 703 fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags);
697 if (fd < 0) 704 if (fd < 0)