]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/notify/inotify/inotify_fsnotify.c
inotify: allow users to request not to recieve events on unlinked children
[net-next-2.6.git] / fs / notify / inotify / inotify_fsnotify.c
index 388a150c3d4a4fbda541b4667bc1af106b88b3a2..9d332e7f5a5c582da04a36c6f26a44ca65fffd3d 100644 (file)
@@ -22,6 +22,7 @@
  * General Public License for more details.
  */
 
+#include <linux/dcache.h> /* d_unlinked */
 #include <linux/fs.h> /* struct inode */
 #include <linux/fsnotify_backend.h>
 #include <linux/inotify.h>
@@ -157,6 +158,14 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode
        mask = (mask & ~FS_EVENT_ON_CHILD);
        send = (fsn_mark->mask & mask);
 
+       if (send && (fsn_mark->mask & FS_EXCL_UNLINK) &&
+           (data_type == FSNOTIFY_EVENT_PATH)) {
+               struct path *path  = data;
+
+               if (d_unlinked(path->dentry))
+                       send = false;
+       }
+
        /* find took a reference */
        fsnotify_put_mark(fsn_mark);