]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - kernel/audit_watch.c
fsnotify: send fsnotify_mark to groups in event handling functions
[net-next-2.6.git] / kernel / audit_watch.c
index 24ecbebf43541c2430f9cc8dd9b23d5fa8288c46..4d5ea0319a6cb283b495d1d64e6b0b1eb1dc68d2 100644 (file)
@@ -101,10 +101,7 @@ static inline struct audit_parent *audit_find_parent(struct inode *inode)
        struct audit_parent *parent = NULL;
        struct fsnotify_mark *entry;
 
-       spin_lock(&inode->i_lock);
-       entry = fsnotify_find_mark(audit_watch_group, inode);
-       spin_unlock(&inode->i_lock);
-
+       entry = fsnotify_find_inode_mark(audit_watch_group, inode);
        if (entry)
                parent = container_of(entry, struct audit_parent, mark);
 
@@ -161,7 +158,7 @@ static struct audit_parent *audit_init_parent(struct nameidata *ndp)
 
        fsnotify_init_mark(&parent->mark, audit_watch_free_mark);
        parent->mark.mask = AUDIT_FS_WATCH;
-       ret = fsnotify_add_mark(&parent->mark, audit_watch_group, inode, 0);
+       ret = fsnotify_add_mark(&parent->mark, audit_watch_group, inode, NULL, 0);
        if (ret < 0) {
                audit_free_parent(parent);
                return ERR_PTR(ret);
@@ -514,15 +511,13 @@ void audit_remove_watch_rule(struct audit_krule *krule)
 }
 
 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 vfsmount *mnt, struct fsnotify_mark *mark,
+                                         __u32 mask, void *data, int data_type)
 {
        struct fsnotify_mark *entry;
        bool send;
 
-       spin_lock(&inode->i_lock);
-       entry = fsnotify_find_mark(group, inode);
-       spin_unlock(&inode->i_lock);
+       entry = fsnotify_find_inode_mark(group, inode);
        if (!entry)
                return false;
 
@@ -536,7 +531,9 @@ static bool audit_watch_should_send_event(struct fsnotify_group *group, struct i
 }
 
 /* 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 *mark,
+                                   struct fsnotify_event *event)
 {
        struct inode *inode;
        __u32 mask = event->mask;
@@ -550,8 +547,8 @@ static int audit_watch_handle_event(struct fsnotify_group *group, struct fsnotif
                return 0;
 
        switch (event->data_type) {
-       case (FSNOTIFY_EVENT_PATH):
-               inode = event->path.dentry->d_inode;
+       case (FSNOTIFY_EVENT_FILE):
+               inode = event->file->f_path.dentry->d_inode;
                break;
        case (FSNOTIFY_EVENT_INODE):
                inode = event->inode;