Lines Matching defs:group
182 static int fanotify_merge(struct fsnotify_group *group,
186 unsigned int bucket = fanotify_event_hash_bucket(group, new);
187 struct hlist_head *hlist = &group->fanotify_data.merge_hash[bucket];
190 pr_debug("%s: group=%p event=%p bucket=%u\n", __func__,
191 group, event, bucket);
224 static int fanotify_get_response(struct fsnotify_group *group,
230 pr_debug("%s: group=%p event=%p\n", __func__, group, event);
232 ret = wait_event_state(group->fanotify_data.access_waitq,
238 spin_lock(&group->notification_lock);
243 spin_unlock(&group->notification_lock);
248 fsnotify_remove_queued_event(group, &event->fae.fse);
257 spin_unlock(&group->notification_lock);
285 pr_debug("%s: group=%p event=%p about to return ret=%d\n", __func__,
286 group, event, ret);
288 fsnotify_destroy_event(group, &event->fae.fse);
299 static u32 fanotify_group_event_mask(struct fsnotify_group *group,
309 unsigned int fid_mode = FAN_GROUP_FLAG(group, FANOTIFY_FID_BITS);
317 if (FAN_GROUP_FLAG(group, FAN_REPORT_MNT)) {
348 /* Record the mark types of this group that matched the event */
364 * fanotify_alloc_event() when group is reporting fid as indication
508 * and the group flags.
510 * With the group flag FAN_REPORT_TARGET_FID, always report the child fid.
512 * Without the group flag FAN_REPORT_TARGET_FID, report the modified directory
709 struct fsnotify_group *group,
723 fee = mempool_alloc(&group->fanotify_data.error_events_pool, GFP_NOFS);
747 struct fsnotify_group *group,
754 unsigned int fid_mode = FAN_GROUP_FLAG(group, FANOTIFY_FID_BITS);
770 * For certain events and group flags, report the child fid
779 * We record file name only in a group with FAN_REPORT_NAME
837 if (group->max_events == UINT_MAX)
843 old_memcg = set_active_memcg(group->memcg);
848 event = fanotify_alloc_error_event(group, fsid, data,
866 if (FAN_GROUP_FLAG(group, FAN_REPORT_TID))
907 static void fanotify_insert_event(struct fsnotify_group *group,
911 unsigned int bucket = fanotify_event_hash_bucket(group, event);
912 struct hlist_head *hlist = &group->fanotify_data.merge_hash[bucket];
914 assert_spin_locked(&group->notification_lock);
919 pr_debug("%s: group=%p event=%p bucket=%u\n", __func__,
920 group, event, bucket);
925 static int fanotify_handle_event(struct fsnotify_group *group, u32 mask,
962 mask = fanotify_group_event_mask(group, iter_info, &match_mask,
967 pr_debug("%s: group=%p mask=%x report_mask=%x\n", __func__,
968 group, mask, match_mask);
979 if (FAN_GROUP_FLAG(group, FANOTIFY_FID_BITS))
982 event = fanotify_alloc_event(group, mask, data, data_type, dir,
991 fsnotify_queue_overflow(group);
996 ret = fsnotify_insert_event(group, fsn_event, fanotify_merge,
1002 fsnotify_destroy_event(group, fsn_event);
1006 ret = fanotify_get_response(group, FANOTIFY_PERM(event),
1016 static void fanotify_free_group_priv(struct fsnotify_group *group)
1018 put_user_ns(group->user_ns);
1019 kfree(group->fanotify_data.merge_hash);
1020 if (group->fanotify_data.ucounts)
1021 dec_ucount(group->fanotify_data.ucounts,
1024 if (mempool_initialized(&group->fanotify_data.error_events_pool))
1025 mempool_exit(&group->fanotify_data.error_events_pool);
1054 static void fanotify_free_error_event(struct fsnotify_group *group,
1059 mempool_free(fee, &group->fanotify_data.error_events_pool);
1067 static void fanotify_free_event(struct fsnotify_group *group,
1091 fanotify_free_error_event(group, event);
1102 struct fsnotify_group *group)
1104 if (!FAN_GROUP_FLAG(group, FAN_UNLIMITED_MARKS))
1105 dec_ucount(group->fanotify_data.ucounts, UCOUNT_FANOTIFY_MARKS);