Lines Matching refs:conn

100 static __u32 *fsnotify_conn_mask_p(struct fsnotify_mark_connector *conn)
102 if (conn->type == FSNOTIFY_OBJ_TYPE_INODE)
103 return &fsnotify_conn_inode(conn)->i_fsnotify_mask;
104 else if (conn->type == FSNOTIFY_OBJ_TYPE_VFSMOUNT)
105 return &fsnotify_conn_mount(conn)->mnt_fsnotify_mask;
106 else if (conn->type == FSNOTIFY_OBJ_TYPE_SB)
107 return &fsnotify_conn_sb(conn)->s_fsnotify_mask;
111 __u32 fsnotify_conn_mask(struct fsnotify_mark_connector *conn)
113 if (WARN_ON(!fsnotify_valid_obj_type(conn->type)))
116 return *fsnotify_conn_mask_p(conn);
133 static struct inode *fsnotify_update_iref(struct fsnotify_mark_connector *conn,
136 bool has_iref = conn->flags & FSNOTIFY_CONN_FLAG_HAS_IREF;
139 if (conn->type != FSNOTIFY_OBJ_TYPE_INODE ||
145 fsnotify_get_inode_ref(fsnotify_conn_inode(conn));
146 conn->flags |= FSNOTIFY_CONN_FLAG_HAS_IREF;
149 inode = fsnotify_conn_inode(conn);
150 conn->flags &= ~FSNOTIFY_CONN_FLAG_HAS_IREF;
156 static void *__fsnotify_recalc_mask(struct fsnotify_mark_connector *conn)
162 assert_spin_locked(&conn->lock);
164 if (!fsnotify_valid_obj_type(conn->type))
166 hlist_for_each_entry(mark, &conn->list, obj_list) {
170 if (conn->type == FSNOTIFY_OBJ_TYPE_INODE &&
174 *fsnotify_conn_mask_p(conn) = new_mask;
176 return fsnotify_update_iref(conn, want_iref);
185 void fsnotify_recalc_mask(struct fsnotify_mark_connector *conn)
187 if (!conn)
190 spin_lock(&conn->lock);
191 __fsnotify_recalc_mask(conn);
192 spin_unlock(&conn->lock);
193 if (conn->type == FSNOTIFY_OBJ_TYPE_INODE)
195 fsnotify_conn_inode(conn));
201 struct fsnotify_mark_connector *conn, *free;
204 conn = connector_destroy_list;
209 while (conn) {
210 free = conn;
211 conn = conn->destroy_next;
225 static void fsnotify_get_sb_connectors(struct fsnotify_mark_connector *conn)
227 struct super_block *sb = fsnotify_connector_sb(conn);
233 static void fsnotify_put_sb_connectors(struct fsnotify_mark_connector *conn)
235 struct super_block *sb = fsnotify_connector_sb(conn);
242 struct fsnotify_mark_connector *conn,
247 *type = conn->type;
248 if (conn->type == FSNOTIFY_OBJ_TYPE_DETACHED)
251 if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) {
252 inode = fsnotify_conn_inode(conn);
256 if (!(conn->flags & FSNOTIFY_CONN_FLAG_HAS_IREF))
258 } else if (conn->type == FSNOTIFY_OBJ_TYPE_VFSMOUNT) {
259 fsnotify_conn_mount(conn)->mnt_fsnotify_mask = 0;
260 } else if (conn->type == FSNOTIFY_OBJ_TYPE_SB) {
261 fsnotify_conn_sb(conn)->s_fsnotify_mask = 0;
264 fsnotify_put_sb_connectors(conn);
265 rcu_assign_pointer(*(conn->obj), NULL);
266 conn->obj = NULL;
267 conn->type = FSNOTIFY_OBJ_TYPE_DETACHED;
295 struct fsnotify_mark_connector *conn = READ_ONCE(mark->connector);
301 if (!conn) {
311 if (!refcount_dec_and_lock(&mark->refcnt, &conn->lock))
315 if (hlist_empty(&conn->list)) {
316 objp = fsnotify_detach_connector_from_object(conn, &type);
319 objp = __fsnotify_recalc_mask(conn);
320 type = conn->type;
323 spin_unlock(&conn->lock);
329 conn->destroy_next = connector_destroy_list;
330 connector_destroy_list = conn;
542 struct fsnotify_mark_connector *conn;
544 conn = kmem_cache_alloc(fsnotify_mark_connector_cachep, GFP_KERNEL);
545 if (!conn)
547 spin_lock_init(&conn->lock);
548 INIT_HLIST_HEAD(&conn->list);
549 conn->flags = 0;
550 conn->type = obj_type;
551 conn->obj = connp;
552 conn->flags = 0;
553 fsnotify_get_sb_connectors(conn);
559 if (cmpxchg(connp, NULL, conn)) {
561 fsnotify_put_sb_connectors(conn);
562 kmem_cache_free(fsnotify_mark_connector_cachep, conn);
577 struct fsnotify_mark_connector *conn;
581 conn = srcu_dereference(*connp, &fsnotify_mark_srcu);
582 if (!conn)
584 spin_lock(&conn->lock);
585 if (conn->type == FSNOTIFY_OBJ_TYPE_DETACHED) {
586 spin_unlock(&conn->lock);
592 return conn;
606 struct fsnotify_mark_connector *conn;
615 conn = fsnotify_grab_connector(connp);
616 if (!conn) {
625 if (hlist_empty(&conn->list)) {
626 hlist_add_head_rcu(&mark->obj_list, &conn->list);
631 hlist_for_each_entry(lmark, &conn->list, obj_list) {
657 WRITE_ONCE(mark->connector, conn);
659 spin_unlock(&conn->lock);
729 struct fsnotify_mark_connector *conn;
732 conn = fsnotify_grab_connector(connp);
733 if (!conn)
736 hlist_for_each_entry(mark, &conn->list, obj_list) {
740 spin_unlock(&conn->lock);
744 spin_unlock(&conn->lock);
797 struct fsnotify_mark_connector *conn;
802 conn = fsnotify_grab_connector(connp);
803 if (!conn)
807 * fsnotify_clear_marks_by_group() and once we drop the conn->lock, the
810 * iteration after regaining conn->lock.
812 hlist_for_each_entry(mark, &conn->list, obj_list) {
814 spin_unlock(&conn->lock);
819 spin_lock(&conn->lock);
826 objp = fsnotify_detach_connector_from_object(conn, &type);
827 spin_unlock(&conn->lock);