]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/notify/inotify/inotify_fsnotify.c
fsnotify: add pr_debug throughout
[net-next-2.6.git] / fs / notify / inotify / inotify_fsnotify.c
index 388a150c3d4a4fbda541b4667bc1af106b88b3a2..906b72761b176e7a37ae28f950c045987f3e605d 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>
@@ -97,6 +98,9 @@ static int inotify_handle_event(struct fsnotify_group *group, struct fsnotify_ev
        struct fsnotify_event_private_data *fsn_event_priv;
        int wd, ret;
 
+       pr_debug("%s: group=%p event=%p to_tell=%p mask=%x\n", __func__, group,
+                event, event->to_tell, event->mask);
+
        to_tell = event->to_tell;
 
        fsn_mark = fsnotify_find_inode_mark(group, to_tell);
@@ -150,6 +154,9 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode
        struct fsnotify_mark *fsn_mark;
        bool send;
 
+       pr_debug("%s: group=%p inode=%p mask=%x data=%p data_type=%d\n",
+                __func__, group, inode, mask, data, data_type);
+
        fsn_mark = fsnotify_find_inode_mark(group, inode);
        if (!fsn_mark)
                return false;
@@ -157,6 +164,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);