Lines Matching refs:watch
202 struct watch *watch; in __post_watch_notification() local
211 hlist_for_each_entry_rcu(watch, &wlist->watchers, list_node) { in __post_watch_notification()
212 if (watch->id != id) in __post_watch_notification()
215 n->info |= watch->info_id; in __post_watch_notification()
217 wqueue = rcu_dereference(watch->queue); in __post_watch_notification()
222 if (security_post_notification(watch->cred, cred, n) < 0) in __post_watch_notification()
417 struct watch *watch = container_of(rcu, struct watch, rcu); in free_watch() local
419 put_watch_queue(rcu_access_pointer(watch->queue)); in free_watch()
420 atomic_dec(&watch->cred->user->nr_watches); in free_watch()
421 put_cred(watch->cred); in free_watch()
422 kfree(watch); in free_watch()
427 struct watch *watch = container_of(kref, struct watch, usage); in __put_watch() local
429 call_rcu(&watch->rcu, free_watch); in __put_watch()
435 static void put_watch(struct watch *watch) in put_watch() argument
437 kref_put(&watch->usage, __put_watch); in put_watch()
447 void init_watch(struct watch *watch, struct watch_queue *wqueue) in init_watch() argument
449 kref_init(&watch->usage); in init_watch()
450 INIT_HLIST_NODE(&watch->list_node); in init_watch()
451 INIT_HLIST_NODE(&watch->queue_node); in init_watch()
452 rcu_assign_pointer(watch->queue, wqueue); in init_watch()
455 static int add_one_watch(struct watch *watch, struct watch_list *wlist, struct watch_queue *wqueue) in add_one_watch() argument
458 struct watch *w; in add_one_watch()
462 if (wqueue == wq && watch->id == w->id) in add_one_watch()
472 watch->cred = get_cred(cred); in add_one_watch()
473 rcu_assign_pointer(watch->watch_list, wlist); in add_one_watch()
476 kref_get(&watch->usage); in add_one_watch()
477 hlist_add_head(&watch->queue_node, &wqueue->watches); in add_one_watch()
478 hlist_add_head_rcu(&watch->list_node, &wlist->watchers); in add_one_watch()
494 int add_watch_to_object(struct watch *watch, struct watch_list *wlist) in add_watch_to_object() argument
501 wqueue = rcu_access_pointer(watch->queue); in add_watch_to_object()
504 ret = add_one_watch(watch, wlist, wqueue); in add_watch_to_object()
529 struct watch *watch; in remove_watch_from_object() local
536 hlist_for_each_entry(watch, &wlist->watchers, list_node) { in remove_watch_from_object()
538 (watch->id == id && rcu_access_pointer(watch->queue) == wq)) in remove_watch_from_object()
546 hlist_del_init_rcu(&watch->list_node); in remove_watch_from_object()
547 rcu_assign_pointer(watch->watch_list, NULL); in remove_watch_from_object()
552 n.watch.type = WATCH_TYPE_META; in remove_watch_from_object()
553 n.watch.subtype = WATCH_META_REMOVAL_NOTIFICATION; in remove_watch_from_object()
554 n.watch.info = watch->info_id | watch_sizeof(n.watch); in remove_watch_from_object()
557 n.watch.info = watch->info_id | watch_sizeof(n); in remove_watch_from_object()
559 wqueue = rcu_dereference(watch->queue); in remove_watch_from_object()
562 post_one_notification(wqueue, &n.watch); in remove_watch_from_object()
564 if (!hlist_unhashed(&watch->queue_node)) { in remove_watch_from_object()
565 hlist_del_init_rcu(&watch->queue_node); in remove_watch_from_object()
566 put_watch(watch); in remove_watch_from_object()
573 void (*release_watch)(struct watch *); in remove_watch_from_object()
577 (*release_watch)(watch); in remove_watch_from_object()
580 put_watch(watch); in remove_watch_from_object()
598 struct watch *watch; in watch_queue_clear() local
611 watch = hlist_entry(wqueue->watches.first, struct watch, queue_node); in watch_queue_clear()
612 hlist_del_init_rcu(&watch->queue_node); in watch_queue_clear()
621 wlist = rcu_dereference(watch->watch_list); in watch_queue_clear()
623 void (*release_watch)(struct watch *); in watch_queue_clear()
627 release = !hlist_unhashed(&watch->list_node); in watch_queue_clear()
629 hlist_del_init_rcu(&watch->list_node); in watch_queue_clear()
630 rcu_assign_pointer(watch->watch_list, NULL); in watch_queue_clear()
644 (*release_watch)(watch); in watch_queue_clear()
647 put_watch(watch); in watch_queue_clear()
651 put_watch(watch); in watch_queue_clear()