• Home
  • Raw
  • Download

Lines Matching full:group

80 		 * With group flag FAN_REPORT_NAME, if name was not recorded in  in fanotify_event_info_len()
98 static struct fanotify_event *get_one_event(struct fsnotify_group *group, in get_one_event() argument
103 unsigned int fid_mode = FAN_GROUP_FLAG(group, FANOTIFY_FID_BITS); in get_one_event()
105 pr_debug("%s: group=%p count=%zd\n", __func__, group, count); in get_one_event()
107 spin_lock(&group->notification_lock); in get_one_event()
108 if (fsnotify_notify_queue_is_empty(group)) in get_one_event()
113 FANOTIFY_E(fsnotify_peek_first_event(group))); in get_one_event()
120 event = FANOTIFY_E(fsnotify_remove_first_event(group)); in get_one_event()
124 spin_unlock(&group->notification_lock); in get_one_event()
128 static int create_fd(struct fsnotify_group *group, struct path *path, in create_fd() argument
134 client_fd = get_unused_fd_flags(group->fanotify_data.f_flags); in create_fd()
143 group->fanotify_data.f_flags | FMODE_NONOTIFY, in create_fd()
164 * drop group->notification_lock.
166 static void finish_permission_event(struct fsnotify_group *group, in finish_permission_event() argument
169 __releases(&group->notification_lock) in finish_permission_event()
173 assert_spin_locked(&group->notification_lock); in finish_permission_event()
179 spin_unlock(&group->notification_lock); in finish_permission_event()
181 fsnotify_destroy_event(group, &event->fae.fse); in finish_permission_event()
184 static int process_access_response(struct fsnotify_group *group, in process_access_response() argument
191 pr_debug("%s: group=%p fd=%d response=%d\n", __func__, group, in process_access_response()
209 if ((response & FAN_AUDIT) && !FAN_GROUP_FLAG(group, FAN_ENABLE_AUDIT)) in process_access_response()
212 spin_lock(&group->notification_lock); in process_access_response()
213 list_for_each_entry(event, &group->fanotify_data.access_list, in process_access_response()
219 finish_permission_event(group, event, response); in process_access_response()
220 wake_up(&group->fanotify_data.access_waitq); in process_access_response()
223 spin_unlock(&group->notification_lock); in process_access_response()
323 static ssize_t copy_event_to_user(struct fsnotify_group *group, in copy_event_to_user() argument
330 unsigned int fid_mode = FAN_GROUP_FLAG(group, FANOTIFY_FID_BITS); in copy_event_to_user()
335 pr_debug("%s: group=%p event=%p\n", __func__, group, event); in copy_event_to_user()
346 fd = create_fd(group, path, &f); in copy_event_to_user()
390 * With only group flag FAN_REPORT_FID only type FID is in copy_event_to_user()
397 * With group flag FAN_REPORT_NAME, if name was not in copy_event_to_user()
407 * With group flag FAN_REPORT_DIR_FID, a single info in copy_event_to_user()
414 * With group flags FAN_REPORT_DIR_FID|FAN_REPORT_FID, in copy_event_to_user()
448 struct fsnotify_group *group = file->private_data; in fanotify_poll() local
451 poll_wait(file, &group->notification_waitq, wait); in fanotify_poll()
452 spin_lock(&group->notification_lock); in fanotify_poll()
453 if (!fsnotify_notify_queue_is_empty(group)) in fanotify_poll()
455 spin_unlock(&group->notification_lock); in fanotify_poll()
463 struct fsnotify_group *group; in fanotify_read() local
470 group = file->private_data; in fanotify_read()
472 pr_debug("%s: group=%p\n", __func__, group); in fanotify_read()
474 add_wait_queue(&group->notification_waitq, &wait); in fanotify_read()
481 event = get_one_event(group, count); in fanotify_read()
503 ret = copy_event_to_user(group, event, buf, count); in fanotify_read()
519 fsnotify_destroy_event(group, &event->fse); in fanotify_read()
522 spin_lock(&group->notification_lock); in fanotify_read()
523 finish_permission_event(group, in fanotify_read()
525 wake_up(&group->fanotify_data.access_waitq); in fanotify_read()
527 spin_lock(&group->notification_lock); in fanotify_read()
529 &group->fanotify_data.access_list); in fanotify_read()
530 spin_unlock(&group->notification_lock); in fanotify_read()
538 remove_wait_queue(&group->notification_waitq, &wait); in fanotify_read()
548 struct fsnotify_group *group; in fanotify_write() local
554 group = file->private_data; in fanotify_write()
561 pr_debug("%s: group=%p count=%zu\n", __func__, group, count); in fanotify_write()
566 ret = process_access_response(group, &response); in fanotify_write()
575 struct fsnotify_group *group = file->private_data; in fanotify_release() local
582 fsnotify_group_stop_queueing(group); in fanotify_release()
588 spin_lock(&group->notification_lock); in fanotify_release()
589 while (!list_empty(&group->fanotify_data.access_list)) { in fanotify_release()
592 event = list_first_entry(&group->fanotify_data.access_list, in fanotify_release()
595 finish_permission_event(group, event, FAN_ALLOW); in fanotify_release()
596 spin_lock(&group->notification_lock); in fanotify_release()
604 while (!fsnotify_notify_queue_is_empty(group)) { in fanotify_release()
607 event = FANOTIFY_E(fsnotify_remove_first_event(group)); in fanotify_release()
609 spin_unlock(&group->notification_lock); in fanotify_release()
610 fsnotify_destroy_event(group, &event->fse); in fanotify_release()
612 finish_permission_event(group, FANOTIFY_PERM(event), in fanotify_release()
615 spin_lock(&group->notification_lock); in fanotify_release()
617 spin_unlock(&group->notification_lock); in fanotify_release()
620 wake_up(&group->fanotify_data.access_waitq); in fanotify_release()
623 fsnotify_destroy_group(group); in fanotify_release()
630 struct fsnotify_group *group; in fanotify_ioctl() local
636 group = file->private_data; in fanotify_ioctl()
642 spin_lock(&group->notification_lock); in fanotify_ioctl()
643 list_for_each_entry(fsn_event, &group->notification_list, list) in fanotify_ioctl()
645 spin_unlock(&group->notification_lock); in fanotify_ioctl()
746 static int fanotify_remove_mark(struct fsnotify_group *group, in fanotify_remove_mark() argument
754 mutex_lock(&group->mark_mutex); in fanotify_remove_mark()
755 fsn_mark = fsnotify_find_mark(connp, group); in fanotify_remove_mark()
757 mutex_unlock(&group->mark_mutex); in fanotify_remove_mark()
767 mutex_unlock(&group->mark_mutex); in fanotify_remove_mark()
776 static int fanotify_remove_vfsmount_mark(struct fsnotify_group *group, in fanotify_remove_vfsmount_mark() argument
780 return fanotify_remove_mark(group, &real_mount(mnt)->mnt_fsnotify_marks, in fanotify_remove_vfsmount_mark()
784 static int fanotify_remove_sb_mark(struct fsnotify_group *group, in fanotify_remove_sb_mark() argument
788 return fanotify_remove_mark(group, &sb->s_fsnotify_marks, mask, in fanotify_remove_sb_mark()
792 static int fanotify_remove_inode_mark(struct fsnotify_group *group, in fanotify_remove_inode_mark() argument
796 return fanotify_remove_mark(group, &inode->i_fsnotify_marks, mask, in fanotify_remove_inode_mark()
820 static struct fsnotify_mark *fanotify_add_new_mark(struct fsnotify_group *group, in fanotify_add_new_mark() argument
828 if (atomic_read(&group->num_marks) > group->fanotify_data.max_marks) in fanotify_add_new_mark()
835 fsnotify_init_mark(mark, group); in fanotify_add_new_mark()
846 static int fanotify_add_mark(struct fsnotify_group *group, in fanotify_add_mark() argument
854 mutex_lock(&group->mark_mutex); in fanotify_add_mark()
855 fsn_mark = fsnotify_find_mark(connp, group); in fanotify_add_mark()
857 fsn_mark = fanotify_add_new_mark(group, connp, type, fsid); in fanotify_add_mark()
859 mutex_unlock(&group->mark_mutex); in fanotify_add_mark()
866 mutex_unlock(&group->mark_mutex); in fanotify_add_mark()
872 static int fanotify_add_vfsmount_mark(struct fsnotify_group *group, in fanotify_add_vfsmount_mark() argument
876 return fanotify_add_mark(group, &real_mount(mnt)->mnt_fsnotify_marks, in fanotify_add_vfsmount_mark()
880 static int fanotify_add_sb_mark(struct fsnotify_group *group, in fanotify_add_sb_mark() argument
884 return fanotify_add_mark(group, &sb->s_fsnotify_marks, in fanotify_add_sb_mark()
888 static int fanotify_add_inode_mark(struct fsnotify_group *group, in fanotify_add_inode_mark() argument
892 pr_debug("%s: group=%p inode=%p\n", __func__, group, inode); in fanotify_add_inode_mark()
904 return fanotify_add_mark(group, &inode->i_fsnotify_marks, in fanotify_add_inode_mark()
925 struct fsnotify_group *group; in SYSCALL_DEFINE2() local
979 group = fsnotify_alloc_group(&fanotify_fsnotify_ops); in SYSCALL_DEFINE2()
980 if (IS_ERR(group)) { in SYSCALL_DEFINE2()
982 return PTR_ERR(group); in SYSCALL_DEFINE2()
985 group->fanotify_data.user = user; in SYSCALL_DEFINE2()
986 group->fanotify_data.flags = flags; in SYSCALL_DEFINE2()
988 group->memcg = get_mem_cgroup_from_mm(current->mm); in SYSCALL_DEFINE2()
990 group->overflow_event = fanotify_alloc_overflow_event(); in SYSCALL_DEFINE2()
991 if (unlikely(!group->overflow_event)) { in SYSCALL_DEFINE2()
998 group->fanotify_data.f_flags = event_f_flags; in SYSCALL_DEFINE2()
999 init_waitqueue_head(&group->fanotify_data.access_waitq); in SYSCALL_DEFINE2()
1000 INIT_LIST_HEAD(&group->fanotify_data.access_list); in SYSCALL_DEFINE2()
1003 group->priority = FS_PRIO_0; in SYSCALL_DEFINE2()
1006 group->priority = FS_PRIO_1; in SYSCALL_DEFINE2()
1009 group->priority = FS_PRIO_2; in SYSCALL_DEFINE2()
1020 group->max_events = UINT_MAX; in SYSCALL_DEFINE2()
1022 group->max_events = FANOTIFY_DEFAULT_MAX_EVENTS; in SYSCALL_DEFINE2()
1029 group->fanotify_data.max_marks = UINT_MAX; in SYSCALL_DEFINE2()
1031 group->fanotify_data.max_marks = FANOTIFY_DEFAULT_MAX_MARKS; in SYSCALL_DEFINE2()
1040 fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags); in SYSCALL_DEFINE2()
1047 fsnotify_destroy_group(group); in SYSCALL_DEFINE2()
1114 struct fsnotify_group *group; in do_fanotify_mark() local
1181 group = f.file->private_data; in do_fanotify_mark()
1184 * group->priority == FS_PRIO_0 == FAN_CLASS_NOTIF. These are not in do_fanotify_mark()
1189 group->priority == FS_PRIO_0) in do_fanotify_mark()
1195 * group supports reporting fid. in do_fanotify_mark()
1199 fid_mode = FAN_GROUP_FLAG(group, FANOTIFY_FID_BITS); in do_fanotify_mark()
1207 fsnotify_clear_vfsmount_marks_by_group(group); in do_fanotify_mark()
1209 fsnotify_clear_sb_marks_by_group(group); in do_fanotify_mark()
1211 fsnotify_clear_inode_marks_by_group(group); in do_fanotify_mark()
1234 /* inode held in place by reference to path; group by fget on fd */ in do_fanotify_mark()
1245 * If group needs to report parent fid, register for getting in do_fanotify_mark()
1257 ret = fanotify_add_vfsmount_mark(group, mnt, mask, in do_fanotify_mark()
1260 ret = fanotify_add_sb_mark(group, mnt->mnt_sb, mask, in do_fanotify_mark()
1263 ret = fanotify_add_inode_mark(group, inode, mask, in do_fanotify_mark()
1268 ret = fanotify_remove_vfsmount_mark(group, mnt, mask, in do_fanotify_mark()
1271 ret = fanotify_remove_sb_mark(group, mnt->mnt_sb, mask, in do_fanotify_mark()
1274 ret = fanotify_remove_inode_mark(group, inode, mask, in do_fanotify_mark()