Lines Matching refs:conn

100 static __u32 *fsnotify_conn_mask_p(struct fsnotify_mark_connector *conn)  in fsnotify_conn_mask_p()  argument
102 if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) in fsnotify_conn_mask_p()
103 return &fsnotify_conn_inode(conn)->i_fsnotify_mask; in fsnotify_conn_mask_p()
104 else if (conn->type == FSNOTIFY_OBJ_TYPE_VFSMOUNT) in fsnotify_conn_mask_p()
105 return &fsnotify_conn_mount(conn)->mnt_fsnotify_mask; in fsnotify_conn_mask_p()
106 else if (conn->type == FSNOTIFY_OBJ_TYPE_SB) in fsnotify_conn_mask_p()
107 return &fsnotify_conn_sb(conn)->s_fsnotify_mask; in fsnotify_conn_mask_p()
111 __u32 fsnotify_conn_mask(struct fsnotify_mark_connector *conn) in fsnotify_conn_mask() argument
113 if (WARN_ON(!fsnotify_valid_obj_type(conn->type))) in fsnotify_conn_mask()
116 return *fsnotify_conn_mask_p(conn); in fsnotify_conn_mask()
119 static void __fsnotify_recalc_mask(struct fsnotify_mark_connector *conn) in __fsnotify_recalc_mask() argument
124 assert_spin_locked(&conn->lock); in __fsnotify_recalc_mask()
126 if (!fsnotify_valid_obj_type(conn->type)) in __fsnotify_recalc_mask()
128 hlist_for_each_entry(mark, &conn->list, obj_list) { in __fsnotify_recalc_mask()
132 *fsnotify_conn_mask_p(conn) = new_mask; in __fsnotify_recalc_mask()
141 void fsnotify_recalc_mask(struct fsnotify_mark_connector *conn) in fsnotify_recalc_mask() argument
143 if (!conn) in fsnotify_recalc_mask()
146 spin_lock(&conn->lock); in fsnotify_recalc_mask()
147 __fsnotify_recalc_mask(conn); in fsnotify_recalc_mask()
148 spin_unlock(&conn->lock); in fsnotify_recalc_mask()
149 if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) in fsnotify_recalc_mask()
151 fsnotify_conn_inode(conn)); in fsnotify_recalc_mask()
157 struct fsnotify_mark_connector *conn, *free; in fsnotify_connector_destroy_workfn() local
160 conn = connector_destroy_list; in fsnotify_connector_destroy_workfn()
165 while (conn) { in fsnotify_connector_destroy_workfn()
166 free = conn; in fsnotify_connector_destroy_workfn()
167 conn = conn->destroy_next; in fsnotify_connector_destroy_workfn()
173 struct fsnotify_mark_connector *conn, in fsnotify_detach_connector_from_object() argument
178 *type = conn->type; in fsnotify_detach_connector_from_object()
179 if (conn->type == FSNOTIFY_OBJ_TYPE_DETACHED) in fsnotify_detach_connector_from_object()
182 if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) { in fsnotify_detach_connector_from_object()
183 inode = fsnotify_conn_inode(conn); in fsnotify_detach_connector_from_object()
186 } else if (conn->type == FSNOTIFY_OBJ_TYPE_VFSMOUNT) { in fsnotify_detach_connector_from_object()
187 fsnotify_conn_mount(conn)->mnt_fsnotify_mask = 0; in fsnotify_detach_connector_from_object()
188 } else if (conn->type == FSNOTIFY_OBJ_TYPE_SB) { in fsnotify_detach_connector_from_object()
189 fsnotify_conn_sb(conn)->s_fsnotify_mask = 0; in fsnotify_detach_connector_from_object()
192 rcu_assign_pointer(*(conn->obj), NULL); in fsnotify_detach_connector_from_object()
193 conn->obj = NULL; in fsnotify_detach_connector_from_object()
194 conn->type = FSNOTIFY_OBJ_TYPE_DETACHED; in fsnotify_detach_connector_from_object()
229 struct fsnotify_mark_connector *conn = READ_ONCE(mark->connector); in fsnotify_put_mark() local
235 if (!conn) { in fsnotify_put_mark()
245 if (!refcount_dec_and_lock(&mark->refcnt, &conn->lock)) in fsnotify_put_mark()
249 if (hlist_empty(&conn->list)) { in fsnotify_put_mark()
250 objp = fsnotify_detach_connector_from_object(conn, &type); in fsnotify_put_mark()
253 __fsnotify_recalc_mask(conn); in fsnotify_put_mark()
256 spin_unlock(&conn->lock); in fsnotify_put_mark()
262 conn->destroy_next = connector_destroy_list; in fsnotify_put_mark()
263 connector_destroy_list = conn; in fsnotify_put_mark()
477 struct fsnotify_mark_connector *conn; in fsnotify_attach_connector_to_object() local
479 conn = kmem_cache_alloc(fsnotify_mark_connector_cachep, GFP_KERNEL); in fsnotify_attach_connector_to_object()
480 if (!conn) in fsnotify_attach_connector_to_object()
482 spin_lock_init(&conn->lock); in fsnotify_attach_connector_to_object()
483 INIT_HLIST_HEAD(&conn->list); in fsnotify_attach_connector_to_object()
484 conn->type = type; in fsnotify_attach_connector_to_object()
485 conn->obj = connp; in fsnotify_attach_connector_to_object()
488 conn->fsid = *fsid; in fsnotify_attach_connector_to_object()
489 conn->flags = FSNOTIFY_CONN_FLAG_HAS_FSID; in fsnotify_attach_connector_to_object()
491 conn->fsid.val[0] = conn->fsid.val[1] = 0; in fsnotify_attach_connector_to_object()
492 conn->flags = 0; in fsnotify_attach_connector_to_object()
494 if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) in fsnotify_attach_connector_to_object()
495 inode = igrab(fsnotify_conn_inode(conn)); in fsnotify_attach_connector_to_object()
500 if (cmpxchg(connp, NULL, conn)) { in fsnotify_attach_connector_to_object()
504 kmem_cache_free(fsnotify_mark_connector_cachep, conn); in fsnotify_attach_connector_to_object()
519 struct fsnotify_mark_connector *conn; in fsnotify_grab_connector() local
523 conn = srcu_dereference(*connp, &fsnotify_mark_srcu); in fsnotify_grab_connector()
524 if (!conn) in fsnotify_grab_connector()
526 spin_lock(&conn->lock); in fsnotify_grab_connector()
527 if (conn->type == FSNOTIFY_OBJ_TYPE_DETACHED) { in fsnotify_grab_connector()
528 spin_unlock(&conn->lock); in fsnotify_grab_connector()
534 return conn; in fsnotify_grab_connector()
548 struct fsnotify_mark_connector *conn; in fsnotify_add_mark_list() local
561 conn = fsnotify_grab_connector(connp); in fsnotify_add_mark_list()
562 if (!conn) { in fsnotify_add_mark_list()
568 } else if (fsid && !(conn->flags & FSNOTIFY_CONN_FLAG_HAS_FSID)) { in fsnotify_add_mark_list()
569 conn->fsid = *fsid; in fsnotify_add_mark_list()
572 conn->flags |= FSNOTIFY_CONN_FLAG_HAS_FSID; in fsnotify_add_mark_list()
573 } else if (fsid && (conn->flags & FSNOTIFY_CONN_FLAG_HAS_FSID) && in fsnotify_add_mark_list()
574 (fsid->val[0] != conn->fsid.val[0] || in fsnotify_add_mark_list()
575 fsid->val[1] != conn->fsid.val[1])) { in fsnotify_add_mark_list()
584 "%x.%x != %x.%x\n", __func__, conn->type, in fsnotify_add_mark_list()
586 conn->fsid.val[0], conn->fsid.val[1]); in fsnotify_add_mark_list()
592 if (hlist_empty(&conn->list)) { in fsnotify_add_mark_list()
593 hlist_add_head_rcu(&mark->obj_list, &conn->list); in fsnotify_add_mark_list()
598 hlist_for_each_entry(lmark, &conn->list, obj_list) { in fsnotify_add_mark_list()
624 WRITE_ONCE(mark->connector, conn); in fsnotify_add_mark_list()
626 spin_unlock(&conn->lock); in fsnotify_add_mark_list()
699 struct fsnotify_mark_connector *conn; in fsnotify_find_mark() local
702 conn = fsnotify_grab_connector(connp); in fsnotify_find_mark()
703 if (!conn) in fsnotify_find_mark()
706 hlist_for_each_entry(mark, &conn->list, obj_list) { in fsnotify_find_mark()
710 spin_unlock(&conn->lock); in fsnotify_find_mark()
714 spin_unlock(&conn->lock); in fsnotify_find_mark()
767 struct fsnotify_mark_connector *conn; in fsnotify_destroy_marks() local
772 conn = fsnotify_grab_connector(connp); in fsnotify_destroy_marks()
773 if (!conn) in fsnotify_destroy_marks()
782 hlist_for_each_entry(mark, &conn->list, obj_list) { in fsnotify_destroy_marks()
784 spin_unlock(&conn->lock); in fsnotify_destroy_marks()
789 spin_lock(&conn->lock); in fsnotify_destroy_marks()
796 objp = fsnotify_detach_connector_from_object(conn, &type); in fsnotify_destroy_marks()
797 spin_unlock(&conn->lock); in fsnotify_destroy_marks()