Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[pandora-kernel.git] / fs / notify / dnotify / dnotify.c
index 6624c2e..3344bdd 100644 (file)
@@ -83,9 +83,10 @@ static void dnotify_recalc_inode_mask(struct fsnotify_mark *fsn_mark)
  * events.
  */
 static int dnotify_handle_event(struct fsnotify_group *group,
+                               struct fsnotify_mark *inode_mark,
+                               struct fsnotify_mark *vfsmount_mark,
                                struct fsnotify_event *event)
 {
-       struct fsnotify_mark *fsn_mark = NULL;
        struct dnotify_mark *dn_mark;
        struct inode *to_tell;
        struct dnotify_struct *dn;
@@ -93,14 +94,13 @@ static int dnotify_handle_event(struct fsnotify_group *group,
        struct fown_struct *fown;
        __u32 test_mask = event->mask & ~FS_EVENT_ON_CHILD;
 
+       BUG_ON(vfsmount_mark);
+
        to_tell = event->to_tell;
 
-       fsn_mark = fsnotify_find_inode_mark(group, to_tell);
-       if (unlikely(!fsn_mark))
-               return 0;
-       dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);
+       dn_mark = container_of(inode_mark, struct dnotify_mark, fsn_mark);
 
-       spin_lock(&fsn_mark->lock);
+       spin_lock(&inode_mark->lock);
        prev = &dn_mark->dn;
        while ((dn = *prev) != NULL) {
                if ((dn->dn_mask & test_mask) == 0) {
@@ -114,12 +114,11 @@ static int dnotify_handle_event(struct fsnotify_group *group,
                else {
                        *prev = dn->dn_next;
                        kmem_cache_free(dnotify_struct_cache, dn);
-                       dnotify_recalc_inode_mask(fsn_mark);
+                       dnotify_recalc_inode_mask(inode_mark);
                }
        }
 
-       spin_unlock(&fsn_mark->lock);
-       fsnotify_put_mark(fsn_mark);
+       spin_unlock(&inode_mark->lock);
 
        return 0;
 }
@@ -129,30 +128,16 @@ static int dnotify_handle_event(struct fsnotify_group *group,
  * userspace notification for that pair.
  */
 static bool dnotify_should_send_event(struct fsnotify_group *group,
-                                     struct inode *inode, struct vfsmount *mnt,
+                                     struct inode *inode,
+                                     struct fsnotify_mark *inode_mark,
+                                     struct fsnotify_mark *vfsmount_mark,
                                      __u32 mask, void *data, int data_type)
 {
-       struct fsnotify_mark *fsn_mark;
-       bool send;
-
-       /* !dir_notify_enable should never get here, don't waste time checking
-       if (!dir_notify_enable)
-               return 0; */
-
        /* not a dir, dnotify doesn't care */
        if (!S_ISDIR(inode->i_mode))
                return false;
 
-       fsn_mark = fsnotify_find_inode_mark(group, inode);
-       if (!fsn_mark)
-               return false;
-
-       mask = (mask & ~FS_EVENT_ON_CHILD);
-       send = (mask & fsn_mark->mask);
-
-       fsnotify_put_mark(fsn_mark); /* matches fsnotify_find_inode_mark */
-
-       return send;
+       return true;
 }
 
 static void dnotify_free_mark(struct fsnotify_mark *fsn_mark)
@@ -218,8 +203,6 @@ void dnotify_flush(struct file *filp, fl_owner_t id)
        if (dn_mark->dn == NULL)
                fsnotify_destroy_mark(fsn_mark);
 
-       fsnotify_recalc_group_mask(dnotify_group);
-
        mutex_unlock(&dnotify_mark_mutex);
 
        fsnotify_put_mark(fsn_mark);
@@ -404,8 +387,6 @@ out:
        if (destroy)
                fsnotify_destroy_mark(fsn_mark);
 
-       fsnotify_recalc_group_mask(dnotify_group);
-
        mutex_unlock(&dnotify_mark_mutex);
        fsnotify_put_mark(fsn_mark);
 out_err: