Lines Matching defs: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);
119 static void __fsnotify_recalc_mask(struct fsnotify_mark_connector *conn)
124 assert_spin_locked(&conn->lock);
126 if (!fsnotify_valid_obj_type(conn->type))
128 hlist_for_each_entry(mark, &conn->list, obj_list) {
132 *fsnotify_conn_mask_p(conn) = new_mask;
141 void fsnotify_recalc_mask(struct fsnotify_mark_connector *conn)
143 if (!conn)
146 spin_lock(&conn->lock);
147 __fsnotify_recalc_mask(conn);
148 spin_unlock(&conn->lock);
149 if (conn->type == FSNOTIFY_OBJ_TYPE_INODE)
151 fsnotify_conn_inode(conn));
157 struct fsnotify_mark_connector *conn, *free;
160 conn = connector_destroy_list;
165 while (conn) {
166 free = conn;
167 conn = conn->destroy_next;
173 struct fsnotify_mark_connector *conn,
178 *type = conn->type;
179 if (conn->type == FSNOTIFY_OBJ_TYPE_DETACHED)
182 if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) {
183 inode = fsnotify_conn_inode(conn);
186 } else if (conn->type == FSNOTIFY_OBJ_TYPE_VFSMOUNT) {
187 fsnotify_conn_mount(conn)->mnt_fsnotify_mask = 0;
188 } else if (conn->type == FSNOTIFY_OBJ_TYPE_SB) {
189 fsnotify_conn_sb(conn)->s_fsnotify_mask = 0;
192 rcu_assign_pointer(*(conn->obj), NULL);
193 conn->obj = NULL;
194 conn->type = FSNOTIFY_OBJ_TYPE_DETACHED;
229 struct fsnotify_mark_connector *conn = READ_ONCE(mark->connector);
235 if (!conn) {
245 if (!refcount_dec_and_lock(&mark->refcnt, &conn->lock))
249 if (hlist_empty(&conn->list)) {
250 objp = fsnotify_detach_connector_from_object(conn, &type);
253 __fsnotify_recalc_mask(conn);
256 spin_unlock(&conn->lock);
262 conn->destroy_next = connector_destroy_list;
263 connector_destroy_list = conn;
481 struct fsnotify_mark_connector *conn;
483 conn = kmem_cache_alloc(fsnotify_mark_connector_cachep, GFP_KERNEL);
484 if (!conn)
486 spin_lock_init(&conn->lock);
487 INIT_HLIST_HEAD(&conn->list);
488 conn->type = type;
489 conn->obj = connp;
492 conn->fsid = *fsid;
493 conn->flags = FSNOTIFY_CONN_FLAG_HAS_FSID;
495 conn->fsid.val[0] = conn->fsid.val[1] = 0;
496 conn->flags = 0;
498 if (conn->type == FSNOTIFY_OBJ_TYPE_INODE)
499 inode = igrab(fsnotify_conn_inode(conn));
504 if (cmpxchg(connp, NULL, conn)) {
508 kmem_cache_free(fsnotify_mark_connector_cachep, conn);
523 struct fsnotify_mark_connector *conn;
527 conn = srcu_dereference(*connp, &fsnotify_mark_srcu);
528 if (!conn)
530 spin_lock(&conn->lock);
531 if (conn->type == FSNOTIFY_OBJ_TYPE_DETACHED) {
532 spin_unlock(&conn->lock);
538 return conn;
552 struct fsnotify_mark_connector *conn;
565 conn = fsnotify_grab_connector(connp);
566 if (!conn) {
572 } else if (fsid && !(conn->flags & FSNOTIFY_CONN_FLAG_HAS_FSID)) {
573 conn->fsid = *fsid;
576 conn->flags |= FSNOTIFY_CONN_FLAG_HAS_FSID;
577 } else if (fsid && (conn->flags & FSNOTIFY_CONN_FLAG_HAS_FSID) &&
578 (fsid->val[0] != conn->fsid.val[0] ||
579 fsid->val[1] != conn->fsid.val[1])) {
583 * Only allow setting conn->fsid once to non zero fsid.
585 * conn->fsid.
588 "%x.%x != %x.%x\n", __func__, conn->type,
590 conn->fsid.val[0], conn->fsid.val[1]);
596 if (hlist_empty(&conn->list)) {
597 hlist_add_head_rcu(&mark->obj_list, &conn->list);
602 hlist_for_each_entry(lmark, &conn->list, obj_list) {
628 WRITE_ONCE(mark->connector, conn);
630 spin_unlock(&conn->lock);
703 struct fsnotify_mark_connector *conn;
706 conn = fsnotify_grab_connector(connp);
707 if (!conn)
710 hlist_for_each_entry(mark, &conn->list, obj_list) {
714 spin_unlock(&conn->lock);
718 spin_unlock(&conn->lock);
771 struct fsnotify_mark_connector *conn;
776 conn = fsnotify_grab_connector(connp);
777 if (!conn)
781 * fsnotify_clear_marks_by_group() and once we drop the conn->lock, the
784 * iteration after regaining conn->lock.
786 hlist_for_each_entry(mark, &conn->list, obj_list) {
788 spin_unlock(&conn->lock);
793 spin_lock(&conn->lock);
800 objp = fsnotify_detach_connector_from_object(conn, &type);
801 spin_unlock(&conn->lock);