Lines Matching full:group
105 struct fsnotify_group *group = file->private_data; in inotify_poll() local
108 poll_wait(file, &group->notification_waitq, wait); in inotify_poll()
109 spin_lock(&group->notification_lock); in inotify_poll()
110 if (!fsnotify_notify_queue_is_empty(group)) in inotify_poll()
112 spin_unlock(&group->notification_lock); in inotify_poll()
132 * Called with the group->notification_lock held.
134 static struct fsnotify_event *get_one_event(struct fsnotify_group *group, in get_one_event() argument
140 if (fsnotify_notify_queue_is_empty(group)) in get_one_event()
143 event = fsnotify_peek_first_event(group); in get_one_event()
145 pr_debug("%s: group=%p event=%p\n", __func__, group, event); in get_one_event()
153 fsnotify_remove_first_event(group); in get_one_event()
164 static ssize_t copy_event_to_user(struct fsnotify_group *group, in copy_event_to_user() argument
174 pr_debug("%s: group=%p event=%p\n", __func__, group, fsn_event); in copy_event_to_user()
217 struct fsnotify_group *group; in inotify_read() local
224 group = file->private_data; in inotify_read()
226 add_wait_queue(&group->notification_waitq, &wait); in inotify_read()
228 spin_lock(&group->notification_lock); in inotify_read()
229 kevent = get_one_event(group, count); in inotify_read()
230 spin_unlock(&group->notification_lock); in inotify_read()
232 pr_debug("%s: group=%p kevent=%p\n", __func__, group, kevent); in inotify_read()
238 ret = copy_event_to_user(group, kevent, buf); in inotify_read()
239 fsnotify_destroy_event(group, kevent); in inotify_read()
259 remove_wait_queue(&group->notification_waitq, &wait); in inotify_read()
268 struct fsnotify_group *group = file->private_data; in inotify_release() local
270 pr_debug("%s: group=%p\n", __func__, group); in inotify_release()
272 /* free this group, matching get was inotify_init->fsnotify_obtain_group */ in inotify_release()
273 fsnotify_destroy_group(group); in inotify_release()
281 struct fsnotify_group *group; in inotify_ioctl() local
287 group = file->private_data; in inotify_ioctl()
290 pr_debug("%s: group=%p cmd=%u\n", __func__, group, cmd); in inotify_ioctl()
294 spin_lock(&group->notification_lock); in inotify_ioctl()
295 list_for_each_entry(fsn_event, &group->notification_list, in inotify_ioctl()
300 spin_unlock(&group->notification_lock); in inotify_ioctl()
309 data = &group->inotify_data; in inotify_ioctl()
379 static struct inotify_inode_mark *inotify_idr_find_locked(struct fsnotify_group *group, in inotify_idr_find_locked() argument
382 struct idr *idr = &group->inotify_data.idr; in inotify_idr_find_locked()
383 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_idr_find_locked()
400 static struct inotify_inode_mark *inotify_idr_find(struct fsnotify_group *group, in inotify_idr_find() argument
404 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_idr_find()
407 i_mark = inotify_idr_find_locked(group, wd); in inotify_idr_find()
417 static void inotify_remove_from_idr(struct fsnotify_group *group, in inotify_remove_from_idr() argument
420 struct idr *idr = &group->inotify_data.idr; in inotify_remove_from_idr()
421 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_remove_from_idr()
433 WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p\n", in inotify_remove_from_idr()
434 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group); in inotify_remove_from_idr()
439 found_i_mark = inotify_idr_find_locked(group, wd); in inotify_remove_from_idr()
441 WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p\n", in inotify_remove_from_idr()
442 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group); in inotify_remove_from_idr()
452 WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p " in inotify_remove_from_idr()
454 "found_i_mark->group=%p\n", __func__, i_mark, in inotify_remove_from_idr()
455 i_mark->wd, i_mark->fsn_mark.group, found_i_mark, in inotify_remove_from_idr()
456 found_i_mark->wd, found_i_mark->fsn_mark.group); in inotify_remove_from_idr()
465 printk(KERN_ERR "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p\n", in inotify_remove_from_idr()
466 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group); in inotify_remove_from_idr()
486 struct fsnotify_group *group) in inotify_ignored_and_remove_idr() argument
495 inotify_handle_event(group, FS_IN_IGNORED, NULL, FSNOTIFY_EVENT_NONE, in inotify_ignored_and_remove_idr()
500 inotify_remove_from_idr(group, i_mark); in inotify_ignored_and_remove_idr()
502 dec_inotify_watches(group->inotify_data.ucounts); in inotify_ignored_and_remove_idr()
505 static int inotify_update_existing_watch(struct fsnotify_group *group, in inotify_update_existing_watch() argument
519 fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group); in inotify_update_existing_watch()
560 static int inotify_new_watch(struct fsnotify_group *group, in inotify_new_watch() argument
567 struct idr *idr = &group->inotify_data.idr; in inotify_new_watch()
568 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_new_watch()
576 fsnotify_init_mark(&tmp_i_mark->fsn_mark, group); in inotify_new_watch()
585 if (!inc_inotify_watches(group->inotify_data.ucounts)) { in inotify_new_watch()
586 inotify_remove_from_idr(group, tmp_i_mark); in inotify_new_watch()
595 inotify_remove_from_idr(group, tmp_i_mark); in inotify_new_watch()
610 static int inotify_update_watch(struct fsnotify_group *group, struct inode *inode, u32 arg) in inotify_update_watch() argument
614 mutex_lock(&group->mark_mutex); in inotify_update_watch()
616 ret = inotify_update_existing_watch(group, inode, arg); in inotify_update_watch()
619 ret = inotify_new_watch(group, inode, arg); in inotify_update_watch()
620 mutex_unlock(&group->mark_mutex); in inotify_update_watch()
627 struct fsnotify_group *group; in inotify_new_group() local
630 group = fsnotify_alloc_group(&inotify_fsnotify_ops); in inotify_new_group()
631 if (IS_ERR(group)) in inotify_new_group()
632 return group; in inotify_new_group()
636 fsnotify_destroy_group(group); in inotify_new_group()
639 group->overflow_event = &oevent->fse; in inotify_new_group()
640 fsnotify_init_event(group->overflow_event, 0); in inotify_new_group()
646 group->max_events = max_events; in inotify_new_group()
647 group->memcg = get_mem_cgroup_from_mm(current->mm); in inotify_new_group()
649 spin_lock_init(&group->inotify_data.idr_lock); in inotify_new_group()
650 idr_init(&group->inotify_data.idr); in inotify_new_group()
651 group->inotify_data.ucounts = inc_ucount(current_user_ns(), in inotify_new_group()
655 if (!group->inotify_data.ucounts) { in inotify_new_group()
656 fsnotify_destroy_group(group); in inotify_new_group()
660 return group; in inotify_new_group()
667 struct fsnotify_group *group; in do_inotify_init() local
677 /* fsnotify_obtain_group took a reference to group, we put this when we kill the file in the end */ in do_inotify_init()
678 group = inotify_new_group(inotify_max_queued_events); in do_inotify_init()
679 if (IS_ERR(group)) in do_inotify_init()
680 return PTR_ERR(group); in do_inotify_init()
682 ret = anon_inode_getfd("inotify", &inotify_fops, group, in do_inotify_init()
685 fsnotify_destroy_group(group); in do_inotify_init()
703 struct fsnotify_group *group; in SYSCALL_DEFINE3() local
752 /* inode held in place by reference to path; group by fget on fd */ in SYSCALL_DEFINE3()
754 group = f.file->private_data; in SYSCALL_DEFINE3()
757 ret = inotify_update_watch(group, inode, mask); in SYSCALL_DEFINE3()
766 struct fsnotify_group *group; in SYSCALL_DEFINE2() local
779 group = f.file->private_data; in SYSCALL_DEFINE2()
781 i_mark = inotify_idr_find(group, wd); in SYSCALL_DEFINE2()
787 fsnotify_destroy_mark(&i_mark->fsn_mark, group); in SYSCALL_DEFINE2()