Commit 7b0a04fbfb35650941af87728d4891515b4fc179

Authored by Eric Paris
1 parent d7f0ce4e43

fsnotify: provide the data type to should_send_event

fanotify is only interested in event types which contain enough information
to open the original file in the context of the fanotify listener.  Since
fanotify may not want to send events if that data isn't present we pass
the data type to the should_send_event function call so fanotify can express
its lack of interest.

Signed-off-by: Eric Paris <eparis@redhat.com>

Showing 6 changed files with 11 additions and 6 deletions Side-by-side Diff

fs/notify/dnotify/dnotify.c
... ... @@ -133,7 +133,8 @@
133 133 * userspace notification for that pair.
134 134 */
135 135 static bool dnotify_should_send_event(struct fsnotify_group *group,
136   - struct inode *inode, __u32 mask)
  136 + struct inode *inode, __u32 mask,
  137 + int data_type)
137 138 {
138 139 struct fsnotify_mark_entry *entry;
139 140 bool send;
fs/notify/fsnotify.c
... ... @@ -157,7 +157,7 @@
157 157 idx = srcu_read_lock(&fsnotify_grp_srcu);
158 158 list_for_each_entry_rcu(group, &fsnotify_groups, group_list) {
159 159 if (test_mask & group->mask) {
160   - if (!group->ops->should_send_event(group, to_tell, mask))
  160 + if (!group->ops->should_send_event(group, to_tell, mask, data_is))
161 161 continue;
162 162 if (!event) {
163 163 event = fsnotify_create_event(to_tell, mask, data,
fs/notify/inotify/inotify_fsnotify.c
... ... @@ -86,7 +86,8 @@
86 86 inotify_ignored_and_remove_idr(entry, group);
87 87 }
88 88  
89   -static bool inotify_should_send_event(struct fsnotify_group *group, struct inode *inode, __u32 mask)
  89 +static bool inotify_should_send_event(struct fsnotify_group *group, struct inode *inode,
  90 + __u32 mask, int data_type)
90 91 {
91 92 struct fsnotify_mark_entry *entry;
92 93 bool send;
include/linux/fsnotify_backend.h
... ... @@ -84,7 +84,8 @@
84 84 * valid group and inode to use to clean up.
85 85 */
86 86 struct fsnotify_ops {
87   - bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode, __u32 mask);
  87 + bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode,
  88 + __u32 mask, int data_type);
88 89 int (*handle_event)(struct fsnotify_group *group, struct fsnotify_event *event);
89 90 void (*free_group_priv)(struct fsnotify_group *group);
90 91 void (*freeing_mark)(struct fsnotify_mark_entry *entry, struct fsnotify_group *group);
... ... @@ -919,7 +919,8 @@
919 919 fsnotify_put_mark(entry);
920 920 }
921 921  
922   -static bool audit_tree_send_event(struct fsnotify_group *group, struct inode *inode, __u32 mask)
  922 +static bool audit_tree_send_event(struct fsnotify_group *group, struct inode *inode,
  923 + __u32 mask, int data_type)
923 924 {
924 925 return 0;
925 926 }
kernel/audit_watch.c
... ... @@ -505,7 +505,8 @@
505 505 }
506 506 }
507 507  
508   -static bool audit_watch_should_send_event(struct fsnotify_group *group, struct inode *inode, __u32 mask)
  508 +static bool audit_watch_should_send_event(struct fsnotify_group *group, struct inode *inode,
  509 + __u32 mask, int data_type)
509 510 {
510 511 struct fsnotify_mark_entry *entry;
511 512 bool send;