android_kernel_motorola_sm6225/fs/notify
Eric Paris c1e5c95402 vfs/fsnotify: fsnotify_close can delay the final work in fput
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>
2010-07-28 10:18:51 -04:00
..
dnotify fsnotify: allow marks to not pin inodes in core 2010-07-28 09:58:59 -04:00
fanotify fsnotify: store struct file not struct path 2010-07-28 10:18:51 -04:00
inotify fsnotify: store struct file not struct path 2010-07-28 10:18:51 -04:00
fsnotify.c fsnotify: store struct file not struct path 2010-07-28 10:18:51 -04:00
fsnotify.h fsnotify: allow marks to not pin inodes in core 2010-07-28 09:58:59 -04:00
group.c fanotify: drop the useless priority argument 2010-07-28 09:59:03 -04:00
inode_mark.c fanotify: clear all fanotify marks 2010-07-28 09:59:00 -04:00
Kconfig fanotify: fscking all notification system 2010-07-28 09:58:54 -04:00
Makefile fsnotify: vfsmount marks generic functions 2010-07-28 09:58:57 -04:00
mark.c fsnotify: call iput on inodes when no longer marked 2010-07-28 09:59:02 -04:00
notification.c vfs/fsnotify: fsnotify_close can delay the final work in fput 2010-07-28 10:18:51 -04:00
vfsmount_mark.c fsnotify: update gfp/slab.h includes 2010-07-28 09:59:03 -04:00