]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
fsnotify: send fsnotify_mark to groups in event handling functions
authorEric Paris <eparis@redhat.com>
Wed, 28 Jul 2010 14:18:38 +0000 (10:18 -0400)
committerEric Paris <eparis@redhat.com>
Wed, 28 Jul 2010 14:18:52 +0000 (10:18 -0400)
With the change of fsnotify to use srcu walking the marks list instead of
walking the global groups list we now know the mark in question.  The code can
send the mark to the group's handling functions and the groups won't have to
find those marks themselves.

Signed-off-by: Eric Paris <eparis@redhat.com>
fs/notify/dnotify/dnotify.c
fs/notify/fanotify/fanotify.c
fs/notify/fsnotify.c
fs/notify/inotify/inotify_fsnotify.c
include/linux/fsnotify_backend.h
kernel/audit_tree.c
kernel/audit_watch.c

index 6624c2ee8786fe9f804e5eb1dfb9c005d065abc9..2cae9be120db2c8d6360a81bb63c83f7b425b9ac 100644 (file)
@@ -83,6 +83,7 @@ static void dnotify_recalc_inode_mask(struct fsnotify_mark *fsn_mark)
  * events.
  */
 static int dnotify_handle_event(struct fsnotify_group *group,
+                               struct fsnotify_mark *mark,
                                struct fsnotify_event *event)
 {
        struct fsnotify_mark *fsn_mark = NULL;
@@ -130,7 +131,8 @@ static int dnotify_handle_event(struct fsnotify_group *group,
  */
 static bool dnotify_should_send_event(struct fsnotify_group *group,
                                      struct inode *inode, struct vfsmount *mnt,
-                                     __u32 mask, void *data, int data_type)
+                                     struct fsnotify_mark *mark, __u32 mask,
+                                     void *data, int data_type)
 {
        struct fsnotify_mark *fsn_mark;
        bool send;
index c2a3029052bca2fa520cec5832f3545cc08a1ac9..abfba45abe2c36abf3366f425e84c1e2513c02c8 100644 (file)
@@ -114,7 +114,9 @@ static int fanotify_get_response_from_access(struct fsnotify_group *group,
 }
 #endif
 
-static int fanotify_handle_event(struct fsnotify_group *group, struct fsnotify_event *event)
+static int fanotify_handle_event(struct fsnotify_group *group,
+                                struct fsnotify_mark *mark,
+                                struct fsnotify_event *event)
 {
        int ret = 0;
        struct fsnotify_event *notify_event = NULL;
@@ -214,8 +216,8 @@ static bool should_send_inode_event(struct fsnotify_group *group, struct inode *
 }
 
 static bool fanotify_should_send_event(struct fsnotify_group *group, struct inode *to_tell,
-                                      struct vfsmount *mnt, __u32 mask, void *data,
-                                      int data_type)
+                                      struct vfsmount *mnt, struct fsnotify_mark *mark,
+                                      __u32 mask, void *data, int data_type)
 {
        pr_debug("%s: group=%p to_tell=%p mnt=%p mask=%x data=%p data_type=%d\n",
                 __func__, group, to_tell, mnt, mask, data, data_type);
index 4678b416241e6e3f08773aafce0c5e5e85542c72..59d639996cad6e0da3f6e85760ccd6432cb2bb68 100644 (file)
@@ -171,15 +171,16 @@ void __fsnotify_flush_ignored_mask(struct inode *inode, void *data, int data_is)
 }
 
 static int send_to_group(struct fsnotify_group *group, struct inode *to_tell,
-                        struct vfsmount *mnt, __u32 mask, void *data,
-                        int data_is, u32 cookie, const unsigned char *file_name,
+                        struct vfsmount *mnt, struct fsnotify_mark *mark,
+                        __u32 mask, void *data, int data_is, u32 cookie,
+                        const unsigned char *file_name,
                         struct fsnotify_event **event)
 {
-       pr_debug("%s: group=%p to_tell=%p mnt=%p mask=%x data=%p data_is=%d"
-                " cookie=%d event=%p\n", __func__, group, to_tell, mnt,
-                mask, data, data_is, cookie, *event);
+       pr_debug("%s: group=%p to_tell=%p mnt=%p mark=%p mask=%x data=%p"
+                " data_is=%d cookie=%d event=%p\n", __func__, group, to_tell,
+                mnt, mark, mask, data, data_is, cookie, *event);
 
-       if (!group->ops->should_send_event(group, to_tell, mnt, mask,
+       if (!group->ops->should_send_event(group, to_tell, mnt, mark, mask,
                                           data, data_is))
                return 0;
        if (!*event) {
@@ -189,7 +190,7 @@ static int send_to_group(struct fsnotify_group *group, struct inode *to_tell,
                if (!*event)
                        return -ENOMEM;
        }
-       return group->ops->handle_event(group, *event);
+       return group->ops->handle_event(group, mark, *event);
 }
 
 static bool needed_by_vfsmount(__u32 test_mask, struct vfsmount *mnt)
@@ -252,7 +253,7 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
                                group = mark->group;
                                if (!group)
                                        continue;
-                               ret = send_to_group(group, to_tell, NULL, mask,
+                               ret = send_to_group(group, to_tell, NULL, mark, mask,
                                                    data, data_is, cookie, file_name,
                                                    &event);
                                if (ret)
@@ -271,7 +272,7 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
                                group = mark->group;
                                if (!group)
                                        continue;
-                               ret = send_to_group(group, to_tell, mnt, mask,
+                               ret = send_to_group(group, to_tell, mnt, mark, mask,
                                                    data, data_is, cookie, file_name,
                                                    &event);
                                if (ret)
index 3c506e0364cc4cb87d6308335d03d9afaa30ddfe..dbd76bbb3e219f40bfa27bfd2ea104f70e0f807a 100644 (file)
@@ -89,7 +89,9 @@ static struct fsnotify_event *inotify_merge(struct list_head *list,
        return last_event;
 }
 
-static int inotify_handle_event(struct fsnotify_group *group, struct fsnotify_event *event)
+static int inotify_handle_event(struct fsnotify_group *group,
+                               struct fsnotify_mark *mark,
+                               struct fsnotify_event *event)
 {
        struct fsnotify_mark *fsn_mark;
        struct inotify_inode_mark *i_mark;
@@ -148,8 +150,8 @@ static void inotify_freeing_mark(struct fsnotify_mark *fsn_mark, struct fsnotify
 }
 
 static bool inotify_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 *fsn_mark;
        bool send;
index 84159390969f77b69acbe11f3f8dd4468b12bf08..225dc0c3a48cccb5b2e4cafb2c3887f57a8deac6 100644 (file)
@@ -92,9 +92,10 @@ struct fsnotify_event_private_data;
  */
 struct fsnotify_ops {
        bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode,
-                                 struct vfsmount *mnt, __u32 mask, void *data,
-                                 int data_type);
-       int (*handle_event)(struct fsnotify_group *group, struct fsnotify_event *event);
+                                 struct vfsmount *mnt, struct fsnotify_mark *mark,
+                                 __u32 mask, void *data, int data_type);
+       int (*handle_event)(struct fsnotify_group *group, struct fsnotify_mark *mark,
+                           struct fsnotify_event *event);
        void (*free_group_priv)(struct fsnotify_group *group);
        void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);
        void (*free_event_priv)(struct fsnotify_event_private_data *priv);
index cfb97d752a618a4bddc4019b1f8767c4bc01967f..584b94360217fdded83653f44112907dc10c17f7 100644 (file)
@@ -903,7 +903,9 @@ static void evict_chunk(struct audit_chunk *chunk)
        mutex_unlock(&audit_filter_mutex);
 }
 
-static int audit_tree_handle_event(struct fsnotify_group *group, struct fsnotify_event *event)
+static int audit_tree_handle_event(struct fsnotify_group *group,
+                                  struct fsnotify_mark *mark,
+                                  struct fsnotify_event *event)
 {
        BUG();
        return -EOPNOTSUPP;
@@ -918,8 +920,8 @@ static void audit_tree_freeing_mark(struct fsnotify_mark *entry, struct fsnotify
 }
 
 static bool audit_tree_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)
 {
        return 0;
 }
index b955a22d8ff19ed01703e1502a561309d85ce6a7..4d5ea0319a6cb283b495d1d64e6b0b1eb1dc68d2 100644 (file)
@@ -511,8 +511,8 @@ 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;
@@ -531,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;