Skip to content

Commit 7b0a04f

Browse files
committed
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>
1 parent d7f0ce4 commit 7b0a04f

6 files changed

Lines changed: 11 additions & 6 deletions

File tree

‎fs/notify/dnotify/dnotify.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ static int dnotify_handle_event(struct fsnotify_group *group,
133133
* userspace notification for that pair.
134134
*/
135135
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)
137138
{
138139
struct fsnotify_mark_entry *entry;
139140
bool send;

‎fs/notify/fsnotify.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, const
157157
idx = srcu_read_lock(&fsnotify_grp_srcu);
158158
list_for_each_entry_rcu(group, &fsnotify_groups, group_list) {
159159
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))
161161
continue;
162162
if (!event) {
163163
event = fsnotify_create_event(to_tell, mask, data,

‎fs/notify/inotify/inotify_fsnotify.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ static void inotify_freeing_mark(struct fsnotify_mark_entry *entry, struct fsnot
8686
inotify_ignored_and_remove_idr(entry, group);
8787
}
8888

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)
9091
{
9192
struct fsnotify_mark_entry *entry;
9293
bool send;

‎include/linux/fsnotify_backend.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ struct fsnotify_event_private_data;
8484
* valid group and inode to use to clean up.
8585
*/
8686
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);
8889
int (*handle_event)(struct fsnotify_group *group, struct fsnotify_event *event);
8990
void (*free_group_priv)(struct fsnotify_group *group);
9091
void (*freeing_mark)(struct fsnotify_mark_entry *entry, struct fsnotify_group *group);

‎kernel/audit_tree.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,8 @@ static void audit_tree_freeing_mark(struct fsnotify_mark_entry *entry, struct fs
919919
fsnotify_put_mark(entry);
920920
}
921921

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)
923924
{
924925
return 0;
925926
}

‎kernel/audit_watch.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@ void audit_remove_watch_rule(struct audit_krule *krule)
505505
}
506506
}
507507

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)
509510
{
510511
struct fsnotify_mark_entry *entry;
511512
bool send;

0 commit comments

Comments
 (0)