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()
481 struct fsnotify_mark_connector *conn; in fsnotify_attach_connector_to_object() local
483 conn = kmem_cache_alloc(fsnotify_mark_connector_cachep, GFP_KERNEL); in fsnotify_attach_connector_to_object()
484 if (!conn) in fsnotify_attach_connector_to_object()
486 spin_lock_init(&conn->lock); in fsnotify_attach_connector_to_object()
487 INIT_HLIST_HEAD(&conn->list); in fsnotify_attach_connector_to_object()
488 conn->type = type; in fsnotify_attach_connector_to_object()
489 conn->obj = connp; in fsnotify_attach_connector_to_object()
492 conn->fsid = *fsid; in fsnotify_attach_connector_to_object()
493 conn->flags = FSNOTIFY_CONN_FLAG_HAS_FSID; in fsnotify_attach_connector_to_object()
495 conn->fsid.val[0] = conn->fsid.val[1] = 0; in fsnotify_attach_connector_to_object()
496 conn->flags = 0; in fsnotify_attach_connector_to_object()
498 if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) in fsnotify_attach_connector_to_object()
499 inode = igrab(fsnotify_conn_inode(conn)); in fsnotify_attach_connector_to_object()
504 if (cmpxchg(connp, NULL, conn)) { in fsnotify_attach_connector_to_object()
508 kmem_cache_free(fsnotify_mark_connector_cachep, conn); in fsnotify_attach_connector_to_object()
523 struct fsnotify_mark_connector *conn; in fsnotify_grab_connector() local
527 conn = srcu_dereference(*connp, &fsnotify_mark_srcu); in fsnotify_grab_connector()
528 if (!conn) in fsnotify_grab_connector()
530 spin_lock(&conn->lock); in fsnotify_grab_connector()
531 if (conn->type == FSNOTIFY_OBJ_TYPE_DETACHED) { in fsnotify_grab_connector()
532 spin_unlock(&conn->lock); in fsnotify_grab_connector()
538 return conn; in fsnotify_grab_connector()
552 struct fsnotify_mark_connector *conn; in fsnotify_add_mark_list() local
565 conn = fsnotify_grab_connector(connp); in fsnotify_add_mark_list()
566 if (!conn) { in fsnotify_add_mark_list()
572 } else if (fsid && !(conn->flags & FSNOTIFY_CONN_FLAG_HAS_FSID)) { in fsnotify_add_mark_list()
573 conn->fsid = *fsid; in fsnotify_add_mark_list()
576 conn->flags |= FSNOTIFY_CONN_FLAG_HAS_FSID; in fsnotify_add_mark_list()
577 } else if (fsid && (conn->flags & FSNOTIFY_CONN_FLAG_HAS_FSID) && in fsnotify_add_mark_list()
578 (fsid->val[0] != conn->fsid.val[0] || in fsnotify_add_mark_list()
579 fsid->val[1] != conn->fsid.val[1])) { in fsnotify_add_mark_list()
588 "%x.%x != %x.%x\n", __func__, conn->type, in fsnotify_add_mark_list()
590 conn->fsid.val[0], conn->fsid.val[1]); in fsnotify_add_mark_list()
596 if (hlist_empty(&conn->list)) { in fsnotify_add_mark_list()
597 hlist_add_head_rcu(&mark->obj_list, &conn->list); in fsnotify_add_mark_list()
602 hlist_for_each_entry(lmark, &conn->list, obj_list) { in fsnotify_add_mark_list()
628 WRITE_ONCE(mark->connector, conn); in fsnotify_add_mark_list()
630 spin_unlock(&conn->lock); in fsnotify_add_mark_list()
703 struct fsnotify_mark_connector *conn; in fsnotify_find_mark() local
706 conn = fsnotify_grab_connector(connp); in fsnotify_find_mark()
707 if (!conn) in fsnotify_find_mark()
710 hlist_for_each_entry(mark, &conn->list, obj_list) { in fsnotify_find_mark()
714 spin_unlock(&conn->lock); in fsnotify_find_mark()
718 spin_unlock(&conn->lock); in fsnotify_find_mark()
771 struct fsnotify_mark_connector *conn; in fsnotify_destroy_marks() local
776 conn = fsnotify_grab_connector(connp); in fsnotify_destroy_marks()
777 if (!conn) in fsnotify_destroy_marks()
786 hlist_for_each_entry(mark, &conn->list, obj_list) { in fsnotify_destroy_marks()
788 spin_unlock(&conn->lock); in fsnotify_destroy_marks()
793 spin_lock(&conn->lock); in fsnotify_destroy_marks()
800 objp = fsnotify_detach_connector_from_object(conn, &type); in fsnotify_destroy_marks()
801 spin_unlock(&conn->lock); in fsnotify_destroy_marks()