summaryrefslogtreecommitdiff
path: root/fs/inotify.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/inotify.c')
-rw-r--r--fs/inotify.c58
1 files changed, 48 insertions, 10 deletions
diff --git a/fs/inotify.c b/fs/inotify.c
index e423bfe0c86..54757be888b 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -29,8 +29,6 @@
#include <linux/mount.h>
#include <linux/namei.h>
#include <linux/poll.h>
-#include <linux/device.h>
-#include <linux/miscdevice.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/writeback.h>
@@ -45,8 +43,8 @@ static kmem_cache_t *event_cachep;
static struct vfsmount *inotify_mnt;
-/* These are configurable via /proc/sys/inotify */
-int inotify_max_user_devices;
+/* these are configurable via /proc/sys/fs/inotify/ */
+int inotify_max_user_instances;
int inotify_max_user_watches;
int inotify_max_queued_events;
@@ -125,6 +123,47 @@ struct inotify_watch {
u32 mask; /* event mask for this watch */
};
+#ifdef CONFIG_SYSCTL
+
+#include <linux/sysctl.h>
+
+static int zero;
+
+ctl_table inotify_table[] = {
+ {
+ .ctl_name = INOTIFY_MAX_USER_INSTANCES,
+ .procname = "max_user_instances",
+ .data = &inotify_max_user_instances,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec_minmax,
+ .strategy = &sysctl_intvec,
+ .extra1 = &zero,
+ },
+ {
+ .ctl_name = INOTIFY_MAX_USER_WATCHES,
+ .procname = "max_user_watches",
+ .data = &inotify_max_user_watches,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec_minmax,
+ .strategy = &sysctl_intvec,
+ .extra1 = &zero,
+ },
+ {
+ .ctl_name = INOTIFY_MAX_QUEUED_EVENTS,
+ .procname = "max_queued_events",
+ .data = &inotify_max_queued_events,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec_minmax,
+ .strategy = &sysctl_intvec,
+ .extra1 = &zero
+ },
+ { .ctl_name = 0 }
+};
+#endif /* CONFIG_SYSCTL */
+
static inline void get_inotify_dev(struct inotify_device *dev)
{
atomic_inc(&dev->count);
@@ -842,7 +881,7 @@ asmlinkage long sys_inotify_init(void)
user = get_uid(current->user);
- if (unlikely(atomic_read(&user->inotify_devs) >= inotify_max_user_devices)) {
+ if (unlikely(atomic_read(&user->inotify_devs) >= inotify_max_user_instances)) {
ret = -EMFILE;
goto out_err;
}
@@ -893,7 +932,7 @@ asmlinkage long sys_inotify_add_watch(int fd, const char *path, u32 mask)
dev = filp->private_data;
- ret = find_inode ((const char __user*)path, &nd);
+ ret = find_inode((const char __user*) path, &nd);
if (ret)
goto fput_and_out;
@@ -950,8 +989,9 @@ asmlinkage long sys_inotify_rm_watch(int fd, u32 wd)
if (!filp)
return -EBADF;
dev = filp->private_data;
- ret = inotify_ignore (dev, wd);
+ ret = inotify_ignore(dev, wd);
fput(filp);
+
return ret;
}
@@ -979,7 +1019,7 @@ static int __init inotify_init(void)
inotify_mnt = kern_mount(&inotify_fs_type);
inotify_max_queued_events = 8192;
- inotify_max_user_devices = 128;
+ inotify_max_user_instances = 8;
inotify_max_user_watches = 8192;
atomic_set(&inotify_cookie, 0);
@@ -991,8 +1031,6 @@ static int __init inotify_init(void)
sizeof(struct inotify_kernel_event),
0, SLAB_PANIC, NULL, NULL);
- printk(KERN_INFO "inotify syscall\n");
-
return 0;
}