- 28 Jul, 2010 40 commits
-
-
Eric Paris authored
should_send_event() and handle_event() will both need to look up the inode event if they get a vfsmount event. Lets just pass both at the same time since we have them both after walking the lists in lockstep. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
We currently walk the list of marks on an inode followed by the list of marks on the vfsmount. These are in order (by the memory address of the group) so lets walk them both together. Eventually we can pass both the inode mark and the vfsmount mark to helpers simultaneously. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
currently ignored_mark clearing is done in a seperate list traversal before the actual list traversal to send events. There is no need for this. Do them at the same time. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
The global fsnotify groups lists were invented as a way to increase the performance of fsnotify by shortcutting events which were not interesting. With the changes to walk the object lists rather than global groups lists these shortcuts are not useful. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
group->mask is now useless. It was originally a shortcut for fsnotify to save on performance. These checks are now redundant, so we remove them. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
Because we walk the object->fsnotify_marks list instead of the global fsnotify groups list we don't need the fsnotify_inode_mask and fsnotify_vfsmount_mask as these were simply shortcuts in fsnotify() for performance. They are now extra checks, rip them out. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
The change to use srcu and walk the object list rather than the global fsnotify_group list means that should_send_event is no longer needed for a number of groups and can be simplified for others. Do that. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
fanotify now gets a mark in the should_send_event and handle_event functions. Rather than look up the mark themselves fanotify should just use the mark it was handed. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
audit now gets a mark in the should_send_event and handle_event functions. Rather than look up the mark themselves audit should just use the mark it was handed. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
dnotify now gets a mark in the should_send_event and handle_event functions. Rather than look up the mark themselves dnotify should just use the mark it was handed. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
inotify now gets a mark in the should_send_event and handle_event functions. Rather than look up the mark themselves inotify should just use the mark it was handed. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
With the change of fsnotify to use srcu walking the marks list instead of walking the global groups list we now know the mark in question. The code can send the mark to the group's handling functions and the groups won't have to find those marks themselves. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Andreas Gruenbacher authored
Instead of moving list elements from destroy_list to &private_destroy_list, exchange the list heads. Signed-off-by:
Andreas Gruenbacher <agruen@suse.de> Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
Currently reading the inode->i_fsnotify_marks or vfsmount->mnt_fsnotify_marks lists are protected by a spinlock on both the read and the write side. This patch protects the read side of those lists with a new single srcu. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
Currently fsnotify check is mark->group is NULL to decide if fsnotify_destroy_mark() has already been called or not. With the upcoming rcu work it is a heck of a lot easier to use an explicit flag than worry about group being set to NULL. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
In preparation for srcu locking use all _rcu appropiete functions for mark list addition, removal, and traversal. The operations are still done under a spinlock at the end of this patch. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
fsnotify_marks currently are placed on objects (inodes or vfsmounts) in arbitrary order. This patch places them in order of the group memory address. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
fanotify almost works like so: user context calls fsnotify_* function with a struct file. fsnotify takes a reference on the struct path user context goes about it's buissiness at some later point in time the fsnotify listener gets the struct path fanotify listener calls dentry_open() to create a file which userspace can deal with listener drops the reference on the struct path at some later point the listener calls close() on it's new file With the switch from struct path to struct file this presents a problem for fput() and fsnotify_close(). fsnotify_close() is called when the filp has already reached 0 and __fput() wants to do it's cleanup. The solution presented here is a bit odd. If an event is created from a struct file we take a reference on the file. We check however if the f_count was already 0 and if so we take an EXTRA reference EVEN THOUGH IT WAS ZERO. In __fput() (where we know the f_count hit 0 once) we check if the f_count is non-zero and if so we drop that 'extra' ref and return without destroying the file. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
Al explains that calling dentry_open() with a mnt/dentry pair is only garunteed to be safe if they are already used in an open struct file. To make sure this is the case don't store and use a struct path in fsnotify, always use a struct file. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
Rather than the horrific void ** argument and such just to pass the fanotify_merge event back to the caller of fsnotify_add_notify_event() have those things return an event if it was different than the event suggusted to be added. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
It can be hard to debug fsnotify since there are so few printks. Use pr_debug to allow for dynamic debugging. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
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>
-
Eric Paris authored
This patch adds a check to make sure that all fsnotify bits are unique and we cannot accidentally use the same bit for 2 different fsnotify event types. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Jerome Marchand authored
The mask checks in inotify_update_existing_watch() and inotify_new_watch() are useless because inotify_arg_to_mask() sets FS_IN_IGNORED and FS_EVENT_ON_CHILD bits anyway. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
inotify uses bits called IN_* and fsnotify uses bits called FS_*. These need to line up. This patch adds build time checks to make sure noone can change these bits so they are not the same. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
An inotify watch on a directory will send events for children even if those children have been unlinked. This patch add a new inotify flag IN_EXCL_UNLINK which allows a watch to specificy they don't care about unlinked children. This should fix performance problems seen by tasks which add a watch to /tmp and then are overrun with events when other processes are reading and writing to unlinked files they created in /tmp. https://bugzilla.kernel.org/show_bug.cgi?id=16296Requested-by:
Matthias Clasen <mclasen@redhat.com> Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
Since the .31 or so notify rewrite inotify has not sent events about inodes which are unmounted. This patch restores those events. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
During the large inotify rewrite to fsnotify I completely dropped support for IN_ONESHOT. Reimplement that support. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Tejun Heo authored
Implicit slab.h inclusion via percpu.h is about to go away. Make sure gfp.h or slab.h is included as necessary. Signed-off-by:
Tejun Heo <tj@kernel.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Eric Paris <eparis@redhat.com> Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
The priority argument in fanotify is useless. Kill it. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
fanotify has default to y in linux-next since it's inception but default to n in the final push to Linus. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
H Hartley Sweeten authored
The symbol inotify_max_user_watches is not used outside this file and should be static. Signed-off-by:
H Hartley Sweeten <hsweeten@visionengravers.com> Cc: John McCutchan <john@johnmccutchan.com> Cc: Robert Love <rlove@rlove.org> Cc: Eric Paris <eparis@parisplace.org> Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
akpm got a warning the fsnotify_mask could be used uninitialized in fsnotify_perm(). It's not actually possible but his compiler complained about it. This patch just initializes it to 0 to shut up the compiler. Reported-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
fsnotify takes an igrab on an inode when it adds a mark. The code was supposed to drop the reference when the mark was removed but didn't. This caused problems when an fs was unmounted because those inodes would clearly not be gone. Thus resulting in the most devistating of messages: VFS: Busy inodes after unmount of loop0. Self-destruct in 5 seconds. >>> Have a nice day... Jiri Slaby bisected the problem to a patch in the fsnotify tree. The code snippets below show my stupidity quite clearly. void fsnotify_destroy_inode_mark(struct fsnotify_mark *mark) { ... mark->inode = NULL; ... } void fsnotify_destroy_mark(struct fsnotify_mark *mark) { struct inode *inode = NULL; ... if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) { fsnotify_destroy_inode_mark(mark); inode = mark->i.inode; } ... if (inode) iput(inode); ... } Obviously the intent was to capture the inode before it was set to NULL in fsnotify_destory_inode_mark() so we wouldn't be leaking inodes forever. Instead we leaked them (and exploded on umount) Reported-by:
Jiri Slaby <jirislaby@gmail.com> Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Jean-Christophe Dubois authored
It seems to me you are always returning 0 in fsnotify, when you should return the error (EPERM) returned by fanotify. Signed-off-by:
Jean-Christophe DUBOIS <jcd@tribudubois.net> Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
remove_access_response() is supposed to have a void return, but was returning 0; Reported-by:
Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
fanotify groups need to respond to events which include permissions types. To do so groups will send a response using write() on the fanotify_fd they have open. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
This is the backend work needed for fanotify to support the new FS_OPEN_PERM and FS_ACCESS_PERM fsnotify events. This is done using the new fsnotify secondary queue. No userspace interface is provided actually respond to or request these events. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Eric Paris authored
introduce a new fsnotify hook, fsnotify_perm(), which is called from the security code. This hook is used to allow fsnotify groups to make access control decisions about events on the system. We also must change the generic fsnotify function to return an error code if we intend these hooks to be in any way useful. Signed-off-by:
Eric Paris <eparis@redhat.com>
-
Dave Young authored
Extern declarations in sysctl.c should be move to their own head file, and then include them in relavant .c files. Move inotify_table extern declaration to linux/inotify.h Signed-off-by:
Dave Young <hidave.darkstar@gmail.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Eric Paris <eparis@redhat.com>
-