Lines Matching full:group

119 	struct fsnotify_group *group = file->private_data;  in inotify_poll()  local
122 poll_wait(file, &group->notification_waitq, wait); in inotify_poll()
123 spin_lock(&group->notification_lock); in inotify_poll()
124 if (!fsnotify_notify_queue_is_empty(group)) in inotify_poll()
126 spin_unlock(&group->notification_lock); in inotify_poll()
146 * Called with the group->notification_lock held.
148 static struct fsnotify_event *get_one_event(struct fsnotify_group *group, in get_one_event() argument
154 event = fsnotify_peek_first_event(group); in get_one_event()
158 pr_debug("%s: group=%p event=%p\n", __func__, group, event); in get_one_event()
166 fsnotify_remove_first_event(group); in get_one_event()
177 static ssize_t copy_event_to_user(struct fsnotify_group *group, in copy_event_to_user() argument
187 pr_debug("%s: group=%p event=%p\n", __func__, group, fsn_event); in copy_event_to_user()
230 struct fsnotify_group *group; in inotify_read() local
237 group = file->private_data; in inotify_read()
239 add_wait_queue(&group->notification_waitq, &wait); in inotify_read()
241 spin_lock(&group->notification_lock); in inotify_read()
242 kevent = get_one_event(group, count); in inotify_read()
243 spin_unlock(&group->notification_lock); in inotify_read()
245 pr_debug("%s: group=%p kevent=%p\n", __func__, group, kevent); in inotify_read()
251 ret = copy_event_to_user(group, kevent, buf); in inotify_read()
252 fsnotify_destroy_event(group, kevent); in inotify_read()
272 remove_wait_queue(&group->notification_waitq, &wait); in inotify_read()
281 struct fsnotify_group *group = file->private_data; in inotify_release() local
283 pr_debug("%s: group=%p\n", __func__, group); in inotify_release()
285 /* free this group, matching get was inotify_init->fsnotify_obtain_group */ in inotify_release()
286 fsnotify_destroy_group(group); in inotify_release()
294 struct fsnotify_group *group; in inotify_ioctl() local
300 group = file->private_data; in inotify_ioctl()
303 pr_debug("%s: group=%p cmd=%u\n", __func__, group, cmd); in inotify_ioctl()
307 spin_lock(&group->notification_lock); in inotify_ioctl()
308 list_for_each_entry(fsn_event, &group->notification_list, in inotify_ioctl()
313 spin_unlock(&group->notification_lock); in inotify_ioctl()
322 data = &group->inotify_data; in inotify_ioctl()
392 static struct inotify_inode_mark *inotify_idr_find_locked(struct fsnotify_group *group, in inotify_idr_find_locked() argument
395 struct idr *idr = &group->inotify_data.idr; in inotify_idr_find_locked()
396 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_idr_find_locked()
413 static struct inotify_inode_mark *inotify_idr_find(struct fsnotify_group *group, in inotify_idr_find() argument
417 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_idr_find()
420 i_mark = inotify_idr_find_locked(group, wd); in inotify_idr_find()
430 static void inotify_remove_from_idr(struct fsnotify_group *group, in inotify_remove_from_idr() argument
433 struct idr *idr = &group->inotify_data.idr; in inotify_remove_from_idr()
434 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_remove_from_idr()
446 WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p\n", in inotify_remove_from_idr()
447 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group); in inotify_remove_from_idr()
452 found_i_mark = inotify_idr_find_locked(group, wd); in inotify_remove_from_idr()
454 WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p\n", in inotify_remove_from_idr()
455 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group); in inotify_remove_from_idr()
465 WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p " in inotify_remove_from_idr()
467 "found_i_mark->group=%p\n", __func__, i_mark, in inotify_remove_from_idr()
468 i_mark->wd, i_mark->fsn_mark.group, found_i_mark, in inotify_remove_from_idr()
469 found_i_mark->wd, found_i_mark->fsn_mark.group); in inotify_remove_from_idr()
478 printk(KERN_ERR "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p\n", in inotify_remove_from_idr()
479 __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group); in inotify_remove_from_idr()
499 struct fsnotify_group *group) in inotify_ignored_and_remove_idr() argument
509 inotify_remove_from_idr(group, i_mark); in inotify_ignored_and_remove_idr()
511 dec_inotify_watches(group->inotify_data.ucounts); in inotify_ignored_and_remove_idr()
514 static int inotify_update_existing_watch(struct fsnotify_group *group, in inotify_update_existing_watch() argument
528 fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group); in inotify_update_existing_watch()
569 static int inotify_new_watch(struct fsnotify_group *group, in inotify_new_watch() argument
576 struct idr *idr = &group->inotify_data.idr; in inotify_new_watch()
577 spinlock_t *idr_lock = &group->inotify_data.idr_lock; in inotify_new_watch()
585 fsnotify_init_mark(&tmp_i_mark->fsn_mark, group); in inotify_new_watch()
594 if (!inc_inotify_watches(group->inotify_data.ucounts)) { in inotify_new_watch()
595 inotify_remove_from_idr(group, tmp_i_mark); in inotify_new_watch()
604 inotify_remove_from_idr(group, tmp_i_mark); in inotify_new_watch()
619 static int inotify_update_watch(struct fsnotify_group *group, struct inode *inode, u32 arg) in inotify_update_watch() argument
623 mutex_lock(&group->mark_mutex); in inotify_update_watch()
625 ret = inotify_update_existing_watch(group, inode, arg); in inotify_update_watch()
628 ret = inotify_new_watch(group, inode, arg); in inotify_update_watch()
629 mutex_unlock(&group->mark_mutex); in inotify_update_watch()
636 struct fsnotify_group *group; in inotify_new_group() local
639 group = fsnotify_alloc_user_group(&inotify_fsnotify_ops); in inotify_new_group()
640 if (IS_ERR(group)) in inotify_new_group()
641 return group; in inotify_new_group()
645 fsnotify_destroy_group(group); in inotify_new_group()
648 group->overflow_event = &oevent->fse; in inotify_new_group()
649 fsnotify_init_event(group->overflow_event); in inotify_new_group()
655 group->max_events = max_events; in inotify_new_group()
656 group->memcg = get_mem_cgroup_from_mm(current->mm); in inotify_new_group()
658 spin_lock_init(&group->inotify_data.idr_lock); in inotify_new_group()
659 idr_init(&group->inotify_data.idr); in inotify_new_group()
660 group->inotify_data.ucounts = inc_ucount(current_user_ns(), in inotify_new_group()
664 if (!group->inotify_data.ucounts) { in inotify_new_group()
665 fsnotify_destroy_group(group); in inotify_new_group()
669 return group; in inotify_new_group()
676 struct fsnotify_group *group; in do_inotify_init() local
686 /* fsnotify_obtain_group took a reference to group, we put this when we kill the file in the end */ in do_inotify_init()
687 group = inotify_new_group(inotify_max_queued_events); in do_inotify_init()
688 if (IS_ERR(group)) in do_inotify_init()
689 return PTR_ERR(group); in do_inotify_init()
691 ret = anon_inode_getfd("inotify", &inotify_fops, group, in do_inotify_init()
694 fsnotify_destroy_group(group); in do_inotify_init()
712 struct fsnotify_group *group; in SYSCALL_DEFINE3() local
761 /* inode held in place by reference to path; group by fget on fd */ in SYSCALL_DEFINE3()
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
788 group = f.file->private_data; in SYSCALL_DEFINE2()
790 i_mark = inotify_idr_find(group, wd); in SYSCALL_DEFINE2()
796 fsnotify_destroy_mark(&i_mark->fsn_mark, group); in SYSCALL_DEFINE2()