• Home
  • Raw
  • Download

Lines Matching full:group

55  * Called with the group->notification_lock held.
57 static struct fsnotify_event *get_one_event(struct fsnotify_group *group, in get_one_event() argument
60 assert_spin_locked(&group->notification_lock); in get_one_event()
62 pr_debug("%s: group=%p count=%zd\n", __func__, group, count); in get_one_event()
64 if (fsnotify_notify_queue_is_empty(group)) in get_one_event()
72 return fsnotify_remove_first_event(group); in get_one_event()
75 static int create_fd(struct fsnotify_group *group, in create_fd() argument
82 pr_debug("%s: group=%p event=%p\n", __func__, group, event); in create_fd()
84 client_fd = get_unused_fd_flags(group->fanotify_data.f_flags); in create_fd()
96 group->fanotify_data.f_flags | FMODE_NONOTIFY, in create_fd()
117 static int fill_event_metadata(struct fsnotify_group *group, in fill_event_metadata() argument
125 pr_debug("%s: group=%p metadata=%p event=%p\n", __func__, in fill_event_metadata()
126 group, metadata, fsn_event); in fill_event_metadata()
139 metadata->fd = create_fd(group, event, file); in fill_event_metadata()
148 struct fsnotify_group *group, int fd) in dequeue_event() argument
152 spin_lock(&group->notification_lock); in dequeue_event()
153 list_for_each_entry(event, &group->fanotify_data.access_list, in dequeue_event()
162 spin_unlock(&group->notification_lock); in dequeue_event()
169 static int process_access_response(struct fsnotify_group *group, in process_access_response() argument
176 pr_debug("%s: group=%p fd=%d response=%d\n", __func__, group, in process_access_response()
194 if ((response & FAN_AUDIT) && !group->fanotify_data.audit) in process_access_response()
197 event = dequeue_event(group, fd); in process_access_response()
202 wake_up(&group->fanotify_data.access_waitq); in process_access_response()
207 static ssize_t copy_event_to_user(struct fsnotify_group *group, in copy_event_to_user() argument
215 pr_debug("%s: group=%p event=%p\n", __func__, group, event); in copy_event_to_user()
217 ret = fill_event_metadata(group, &fanotify_event_metadata, event, &f); in copy_event_to_user()
245 struct fsnotify_group *group = file->private_data; in fanotify_poll() local
248 poll_wait(file, &group->notification_waitq, wait); in fanotify_poll()
249 spin_lock(&group->notification_lock); in fanotify_poll()
250 if (!fsnotify_notify_queue_is_empty(group)) in fanotify_poll()
252 spin_unlock(&group->notification_lock); in fanotify_poll()
260 struct fsnotify_group *group; in fanotify_read() local
267 group = file->private_data; in fanotify_read()
269 pr_debug("%s: group=%p\n", __func__, group); in fanotify_read()
271 add_wait_queue(&group->notification_waitq, &wait); in fanotify_read()
273 spin_lock(&group->notification_lock); in fanotify_read()
274 kevent = get_one_event(group, count); in fanotify_read()
275 spin_unlock(&group->notification_lock); in fanotify_read()
298 ret = copy_event_to_user(group, kevent, buf); in fanotify_read()
314 fsnotify_destroy_event(group, kevent); in fanotify_read()
318 wake_up(&group->fanotify_data.access_waitq); in fanotify_read()
320 spin_lock(&group->notification_lock); in fanotify_read()
322 &group->fanotify_data.access_list); in fanotify_read()
323 spin_unlock(&group->notification_lock); in fanotify_read()
331 remove_wait_queue(&group->notification_waitq, &wait); in fanotify_read()
341 struct fsnotify_group *group; in fanotify_write() local
347 group = file->private_data; in fanotify_write()
352 pr_debug("%s: group=%p count=%zu\n", __func__, group, count); in fanotify_write()
357 ret = process_access_response(group, &response); in fanotify_write()
366 struct fsnotify_group *group = file->private_data; in fanotify_release() local
375 fsnotify_group_stop_queueing(group); in fanotify_release()
381 spin_lock(&group->notification_lock); in fanotify_release()
382 list_for_each_entry_safe(event, next, &group->fanotify_data.access_list, in fanotify_release()
384 pr_debug("%s: found group=%p event=%p\n", __func__, group, in fanotify_release()
396 while (!fsnotify_notify_queue_is_empty(group)) { in fanotify_release()
397 fsn_event = fsnotify_remove_first_event(group); in fanotify_release()
399 spin_unlock(&group->notification_lock); in fanotify_release()
400 fsnotify_destroy_event(group, fsn_event); in fanotify_release()
401 spin_lock(&group->notification_lock); in fanotify_release()
406 spin_unlock(&group->notification_lock); in fanotify_release()
409 wake_up(&group->fanotify_data.access_waitq); in fanotify_release()
412 fsnotify_destroy_group(group); in fanotify_release()
419 struct fsnotify_group *group; in fanotify_ioctl() local
425 group = file->private_data; in fanotify_ioctl()
431 spin_lock(&group->notification_lock); in fanotify_ioctl()
432 list_for_each_entry(fsn_event, &group->notification_list, list) in fanotify_ioctl()
434 spin_unlock(&group->notification_lock); in fanotify_ioctl()
528 static int fanotify_remove_mark(struct fsnotify_group *group, in fanotify_remove_mark() argument
536 mutex_lock(&group->mark_mutex); in fanotify_remove_mark()
537 fsn_mark = fsnotify_find_mark(connp, group); in fanotify_remove_mark()
539 mutex_unlock(&group->mark_mutex); in fanotify_remove_mark()
549 mutex_unlock(&group->mark_mutex); in fanotify_remove_mark()
558 static int fanotify_remove_vfsmount_mark(struct fsnotify_group *group, in fanotify_remove_vfsmount_mark() argument
562 return fanotify_remove_mark(group, &real_mount(mnt)->mnt_fsnotify_marks, in fanotify_remove_vfsmount_mark()
566 static int fanotify_remove_inode_mark(struct fsnotify_group *group, in fanotify_remove_inode_mark() argument
570 return fanotify_remove_mark(group, &inode->i_fsnotify_marks, mask, in fanotify_remove_inode_mark()
603 static struct fsnotify_mark *fanotify_add_new_mark(struct fsnotify_group *group, in fanotify_add_new_mark() argument
610 if (atomic_read(&group->num_marks) > group->fanotify_data.max_marks) in fanotify_add_new_mark()
617 fsnotify_init_mark(mark, group); in fanotify_add_new_mark()
628 static int fanotify_add_mark(struct fsnotify_group *group, in fanotify_add_mark() argument
635 mutex_lock(&group->mark_mutex); in fanotify_add_mark()
636 fsn_mark = fsnotify_find_mark(connp, group); in fanotify_add_mark()
638 fsn_mark = fanotify_add_new_mark(group, connp, type); in fanotify_add_mark()
640 mutex_unlock(&group->mark_mutex); in fanotify_add_mark()
647 mutex_unlock(&group->mark_mutex); in fanotify_add_mark()
653 static int fanotify_add_vfsmount_mark(struct fsnotify_group *group, in fanotify_add_vfsmount_mark() argument
657 return fanotify_add_mark(group, &real_mount(mnt)->mnt_fsnotify_marks, in fanotify_add_vfsmount_mark()
661 static int fanotify_add_inode_mark(struct fsnotify_group *group, in fanotify_add_inode_mark() argument
665 pr_debug("%s: group=%p inode=%p\n", __func__, group, inode); in fanotify_add_inode_mark()
677 return fanotify_add_mark(group, &inode->i_fsnotify_marks, in fanotify_add_inode_mark()
684 struct fsnotify_group *group; in SYSCALL_DEFINE2() local
727 group = fsnotify_alloc_group(&fanotify_fsnotify_ops); in SYSCALL_DEFINE2()
728 if (IS_ERR(group)) { in SYSCALL_DEFINE2()
730 return PTR_ERR(group); in SYSCALL_DEFINE2()
733 group->fanotify_data.user = user; in SYSCALL_DEFINE2()
735 group->memcg = get_mem_cgroup_from_mm(current->mm); in SYSCALL_DEFINE2()
737 oevent = fanotify_alloc_event(group, NULL, FS_Q_OVERFLOW, NULL); in SYSCALL_DEFINE2()
742 group->overflow_event = &oevent->fse; in SYSCALL_DEFINE2()
746 group->fanotify_data.f_flags = event_f_flags; in SYSCALL_DEFINE2()
747 init_waitqueue_head(&group->fanotify_data.access_waitq); in SYSCALL_DEFINE2()
748 INIT_LIST_HEAD(&group->fanotify_data.access_list); in SYSCALL_DEFINE2()
751 group->priority = FS_PRIO_0; in SYSCALL_DEFINE2()
754 group->priority = FS_PRIO_1; in SYSCALL_DEFINE2()
757 group->priority = FS_PRIO_2; in SYSCALL_DEFINE2()
768 group->max_events = UINT_MAX; in SYSCALL_DEFINE2()
770 group->max_events = FANOTIFY_DEFAULT_MAX_EVENTS; in SYSCALL_DEFINE2()
777 group->fanotify_data.max_marks = UINT_MAX; in SYSCALL_DEFINE2()
779 group->fanotify_data.max_marks = FANOTIFY_DEFAULT_MAX_MARKS; in SYSCALL_DEFINE2()
786 group->fanotify_data.audit = true; in SYSCALL_DEFINE2()
789 fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags); in SYSCALL_DEFINE2()
796 fsnotify_destroy_group(group); in SYSCALL_DEFINE2()
805 struct fsnotify_group *group; in do_fanotify_mark() local
853 group = f.file->private_data; in do_fanotify_mark()
856 * group->priority == FS_PRIO_0 == FAN_CLASS_NOTIF. These are not in do_fanotify_mark()
861 group->priority == FS_PRIO_0) in do_fanotify_mark()
867 fsnotify_clear_vfsmount_marks_by_group(group); in do_fanotify_mark()
869 fsnotify_clear_inode_marks_by_group(group); in do_fanotify_mark()
877 /* inode held in place by reference to path; group by fget on fd */ in do_fanotify_mark()
887 ret = fanotify_add_vfsmount_mark(group, mnt, mask, flags); in do_fanotify_mark()
889 ret = fanotify_add_inode_mark(group, inode, mask, flags); in do_fanotify_mark()
893 ret = fanotify_remove_vfsmount_mark(group, mnt, mask, flags); in do_fanotify_mark()
895 ret = fanotify_remove_inode_mark(group, inode, mask, flags); in do_fanotify_mark()