@@ -601,7 +601,7 @@ static struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group,
* event queue, so event reported on parent is merged with event
* reported on child when both directory and child watches exist.
*/
- fanotify_init_event(event, (unsigned long)id, mask);
+ fanotify_init_event(group, event, (unsigned long)id, mask);
if (FAN_GROUP_FLAG(group, FAN_REPORT_TID))
event->pid = get_pid(task_pid(current));
else
@@ -144,10 +144,11 @@ struct fanotify_event {
struct pid *pid;
};
-static inline void fanotify_init_event(struct fanotify_event *event,
+static inline void fanotify_init_event(struct fsnotify_group *group,
+ struct fanotify_event *event,
unsigned long id, u32 mask)
{
- fsnotify_init_event(&event->fse, id);
+ fsnotify_init_event(group, &event->fse, id);
event->mask = mask;
event->pid = NULL;
}
@@ -911,7 +911,7 @@ static int fanotify_add_inode_mark(struct fsnotify_group *group,
FSNOTIFY_OBJ_TYPE_INODE, mask, flags, fsid);
}
-static struct fsnotify_event *fanotify_alloc_overflow_event(void)
+static struct fsnotify_event *fanotify_alloc_overflow_event(struct fsnotify_group *group)
{
struct fanotify_event *oevent;
@@ -919,7 +919,7 @@ static struct fsnotify_event *fanotify_alloc_overflow_event(void)
if (!oevent)
return NULL;
- fanotify_init_event(oevent, 0, FS_Q_OVERFLOW);
+ fanotify_init_event(group, oevent, 0, FS_Q_OVERFLOW);
oevent->type = FANOTIFY_EVENT_TYPE_OVERFLOW;
return &oevent->fse;
@@ -993,7 +993,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
atomic_inc(&user->fanotify_listeners);
group->memcg = get_mem_cgroup_from_mm(current->mm);
- group->overflow_event = fanotify_alloc_overflow_event();
+ group->overflow_event = fanotify_alloc_overflow_event(group);
if (unlikely(!group->overflow_event)) {
fd = -ENOMEM;
goto out_destroy_group;
@@ -107,7 +107,7 @@ int inotify_handle_inode_event(struct fsnotify_mark *inode_mark, u32 mask,
mask &= ~IN_ISDIR;
fsn_event = &event->fse;
- fsnotify_init_event(fsn_event, 0);
+ fsnotify_init_event(group, fsn_event, 0);
event->mask = mask;
event->wd = i_mark->wd;
event->sync_cookie = cookie;
@@ -642,7 +642,7 @@ static struct fsnotify_group *inotify_new_group(unsigned int max_events)
return ERR_PTR(-ENOMEM);
}
group->overflow_event = &oevent->fse;
- fsnotify_init_event(group->overflow_event, 0);
+ fsnotify_init_event(group, group->overflow_event, 0);
oevent->mask = FS_Q_OVERFLOW;
oevent->wd = -1;
oevent->sync_cookie = 0;
@@ -579,7 +579,8 @@ extern void fsnotify_put_mark(struct fsnotify_mark *mark);
extern void fsnotify_finish_user_wait(struct fsnotify_iter_info *iter_info);
extern bool fsnotify_prepare_user_wait(struct fsnotify_iter_info *iter_info);
-static inline void fsnotify_init_event(struct fsnotify_event *event,
+static inline void fsnotify_init_event(struct fsnotify_group *group,
+ struct fsnotify_event *event,
unsigned long objectid)
{
INIT_LIST_HEAD(&event->list);
This is used by following patches when deciding about which fields to initialize. Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com> --- fs/notify/fanotify/fanotify.c | 2 +- fs/notify/fanotify/fanotify.h | 5 +++-- fs/notify/fanotify/fanotify_user.c | 6 +++--- fs/notify/inotify/inotify_fsnotify.c | 2 +- fs/notify/inotify/inotify_user.c | 2 +- include/linux/fsnotify_backend.h | 3 ++- 6 files changed, 11 insertions(+), 9 deletions(-)