Lines Matching refs:group
103 struct fsnotify_group *group = file->private_data; in inotify_poll() local
106 poll_wait(file, &group->notification_waitq, wait); in inotify_poll()
107 spin_lock(&group->notification_lock); in inotify_poll()
108 if (!fsnotify_notify_queue_is_empty(group)) in inotify_poll()
110 spin_unlock(&group->notification_lock); in inotify_poll()
132 static struct fsnotify_event *get_one_event(struct fsnotify_group *group, in get_one_event() argument
138 if (fsnotify_notify_queue_is_empty(group)) in get_one_event()
141 event = fsnotify_peek_first_event(group); in get_one_event()
143 pr_debug("%s: group=%p event=%p\n", __func__, group, event); in get_one_event()
151 fsnotify_remove_first_event(group); in get_one_event()
162 static ssize_t copy_event_to_user(struct fsnotify_group *group, in copy_event_to_user() argument
172 pr_debug("%s: group=%p event=%p\n", __func__, group, fsn_event); in copy_event_to_user()
215 struct fsnotify_group *group; in inotify_read() local
222 group = file->private_data; in inotify_read()
224 add_wait_queue(&group->notification_waitq, &wait); in inotify_read()
226 spin_lock(&group->notification_lock); in inotify_read()
227 kevent = get_one_event(group, count); in inotify_read()
228 spin_unlock(&group->notification_lock); in inotify_read()
230 pr_debug("%s: group=%p kevent=%p\n", __func__, group, kevent); in inotify_read()
236 ret = copy_event_to_user(group, kevent, buf); in inotify_read()
237 fsnotify_destroy_event(group, kevent); in inotify_read()
257 remove_wait_queue(&group->notification_waitq, &wait); in inotify_read()
266 struct fsnotify_group *group = file->private_data; in inotify_release() local
268 pr_debug("%s: group=%p\n", __func__, group); in inotify_release()
271 fsnotify_destroy_group(group); in inotify_release()
279 struct fsnotify_group *group; in inotify_ioctl() local
285 group = file->private_data; in inotify_ioctl()
288 pr_debug("%s: group=%p cmd=%u\n", __func__, group, cmd); in inotify_ioctl()
292 spin_lock(&group->notification_lock); in inotify_ioctl()
293 list_for_each_entry(fsn_event, &group->notification_list, in inotify_ioctl()
298 spin_unlock(&group->notification_lock); in inotify_ioctl()
307 data = &group->inotify_data; in inotify_ioctl()
377 static struct inotify_inode_mark *inotify_idr_find_locked(struct fsnotify_group *group, in inotify_idr_find_locked() argument
380 struct idr *idr = &group->inotify_data.idr; in inotify_idr_find_locked()
381 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_idr_find_locked()
398 static struct inotify_inode_mark *inotify_idr_find(struct fsnotify_group *group, in inotify_idr_find() argument
402 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_idr_find()
405 i_mark = inotify_idr_find_locked(group, wd); in inotify_idr_find()
415 static void inotify_remove_from_idr(struct fsnotify_group *group, in inotify_remove_from_idr() argument
418 struct idr *idr = &group->inotify_data.idr; in inotify_remove_from_idr()
419 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_remove_from_idr()
432 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group); in inotify_remove_from_idr()
437 found_i_mark = inotify_idr_find_locked(group, wd); in inotify_remove_from_idr()
440 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group); in inotify_remove_from_idr()
453 i_mark->wd, i_mark->fsn_mark.group, found_i_mark, in inotify_remove_from_idr()
454 found_i_mark->wd, found_i_mark->fsn_mark.group); in inotify_remove_from_idr()
464 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group); in inotify_remove_from_idr()
484 struct fsnotify_group *group) in inotify_ignored_and_remove_idr() argument
493 inotify_handle_event(group, NULL, FS_IN_IGNORED, NULL, in inotify_ignored_and_remove_idr()
498 inotify_remove_from_idr(group, i_mark); in inotify_ignored_and_remove_idr()
500 dec_inotify_watches(group->inotify_data.ucounts); in inotify_ignored_and_remove_idr()
503 static int inotify_update_existing_watch(struct fsnotify_group *group, in inotify_update_existing_watch() argument
517 fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group); in inotify_update_existing_watch()
558 static int inotify_new_watch(struct fsnotify_group *group, in inotify_new_watch() argument
565 struct idr *idr = &group->inotify_data.idr; in inotify_new_watch()
566 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_new_watch()
574 fsnotify_init_mark(&tmp_i_mark->fsn_mark, group); in inotify_new_watch()
583 if (!inc_inotify_watches(group->inotify_data.ucounts)) { in inotify_new_watch()
584 inotify_remove_from_idr(group, tmp_i_mark); in inotify_new_watch()
593 inotify_remove_from_idr(group, tmp_i_mark); in inotify_new_watch()
608 static int inotify_update_watch(struct fsnotify_group *group, struct inode *inode, u32 arg) in inotify_update_watch() argument
612 mutex_lock(&group->mark_mutex); in inotify_update_watch()
614 ret = inotify_update_existing_watch(group, inode, arg); in inotify_update_watch()
617 ret = inotify_new_watch(group, inode, arg); in inotify_update_watch()
618 mutex_unlock(&group->mark_mutex); in inotify_update_watch()
625 struct fsnotify_group *group; in inotify_new_group() local
628 group = fsnotify_alloc_group(&inotify_fsnotify_ops); in inotify_new_group()
629 if (IS_ERR(group)) in inotify_new_group()
630 return group; in inotify_new_group()
634 fsnotify_destroy_group(group); in inotify_new_group()
637 group->overflow_event = &oevent->fse; in inotify_new_group()
638 fsnotify_init_event(group->overflow_event, NULL); in inotify_new_group()
644 group->max_events = max_events; in inotify_new_group()
645 group->memcg = get_mem_cgroup_from_mm(current->mm); in inotify_new_group()
647 spin_lock_init(&group->inotify_data.idr_lock); in inotify_new_group()
648 idr_init(&group->inotify_data.idr); in inotify_new_group()
649 group->inotify_data.ucounts = inc_ucount(current_user_ns(), in inotify_new_group()
653 if (!group->inotify_data.ucounts) { in inotify_new_group()
654 fsnotify_destroy_group(group); in inotify_new_group()
658 return group; in inotify_new_group()
665 struct fsnotify_group *group; in do_inotify_init() local
676 group = inotify_new_group(inotify_max_queued_events); in do_inotify_init()
677 if (IS_ERR(group)) in do_inotify_init()
678 return PTR_ERR(group); in do_inotify_init()
680 ret = anon_inode_getfd("inotify", &inotify_fops, group, in do_inotify_init()
683 fsnotify_destroy_group(group); in do_inotify_init()
701 struct fsnotify_group *group; in SYSCALL_DEFINE3() local
763 group = f.file->private_data; in SYSCALL_DEFINE3()
766 ret = inotify_update_watch(group, inode, mask); in SYSCALL_DEFINE3()
775 struct fsnotify_group *group; in SYSCALL_DEFINE2() local
789 group = f.file->private_data; in SYSCALL_DEFINE2()
792 i_mark = inotify_idr_find(group, wd); in SYSCALL_DEFINE2()
798 fsnotify_destroy_mark(&i_mark->fsn_mark, group); in SYSCALL_DEFINE2()