UBUNTU: Ubuntu-2.6.38-12.51
[linux-flexiantxendom0-natty.git] / kernel / audit_watch.c
index 7499397..d2e3c78 100644 (file)
@@ -60,7 +60,7 @@ struct audit_parent {
 };
 
 /* fsnotify handle. */
-struct fsnotify_group *audit_watch_group;
+static struct fsnotify_group *audit_watch_group;
 
 /* fsnotify events we care about. */
 #define AUDIT_FS_WATCH (FS_MOVE | FS_CREATE | FS_DELETE | FS_DELETE_SELF |\
@@ -123,7 +123,7 @@ void audit_put_watch(struct audit_watch *watch)
        }
 }
 
-void audit_remove_watch(struct audit_watch *watch)
+static void audit_remove_watch(struct audit_watch *watch)
 {
        list_del(&watch->wlist);
        audit_put_parent(watch->parent);
@@ -164,8 +164,6 @@ static struct audit_parent *audit_init_parent(struct nameidata *ndp)
                return ERR_PTR(ret);
        }
 
-       fsnotify_recalc_group_mask(audit_watch_group);
-
        return parent;
 }
 
@@ -352,9 +350,6 @@ static void audit_remove_parent_watches(struct audit_parent *parent)
        mutex_unlock(&audit_filter_mutex);
 
        fsnotify_destroy_mark(&parent->mark);
-
-       fsnotify_recalc_group_mask(audit_watch_group);
-
 }
 
 /* Get path information necessary for adding watches. */
@@ -505,44 +500,30 @@ void audit_remove_watch_rule(struct audit_krule *krule)
                        audit_put_parent(parent);
                }
        }
-
-       fsnotify_recalc_group_mask(audit_watch_group);
-
 }
 
 static bool audit_watch_should_send_event(struct fsnotify_group *group, struct inode *inode,
-                                         struct vfsmount *mnt, __u32 mask, void *data,
-                                         int data_type)
+                                         struct fsnotify_mark *inode_mark,
+                                         struct fsnotify_mark *vfsmount_mark,
+                                         __u32 mask, void *data, int data_type)
 {
-       struct fsnotify_mark *entry;
-       bool send;
-
-       entry = fsnotify_find_inode_mark(group, inode);
-       if (!entry)
-               return false;
-
-       mask = (mask & ~FS_EVENT_ON_CHILD);
-       send = (entry->mask & mask);
-
-       /* find took a reference */
-       fsnotify_put_mark(entry);
-
-       return send;
+       return true;
 }
 
 /* Update watch data in audit rules based on fsnotify events. */
-static int audit_watch_handle_event(struct fsnotify_group *group, struct fsnotify_event *event)
+static int audit_watch_handle_event(struct fsnotify_group *group,
+                                   struct fsnotify_mark *inode_mark,
+                                   struct fsnotify_mark *vfsmount_mark,
+                                   struct fsnotify_event *event)
 {
        struct inode *inode;
        __u32 mask = event->mask;
        const char *dname = event->file_name;
        struct audit_parent *parent;
 
-       BUG_ON(group != audit_watch_group);
+       parent = container_of(inode_mark, struct audit_parent, mark);
 
-       parent = audit_find_parent(event->to_tell);
-       if (unlikely(!parent))
-               return 0;
+       BUG_ON(group != audit_watch_group);
 
        switch (event->data_type) {
        case (FSNOTIFY_EVENT_PATH):
@@ -563,10 +544,6 @@ static int audit_watch_handle_event(struct fsnotify_group *group, struct fsnotif
                audit_update_watch(parent, dname, (dev_t)-1, (unsigned long)-1, 1);
        else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF))
                audit_remove_parent_watches(parent);
-       /* moved put_inotify_watch to freeing mark */
-
-       /* matched the ref taken by audit_find_parent */
-       audit_put_parent(parent);
 
        return 0;
 }