Lines Matching +full:ns +full:-

1 // SPDX-License-Identifier: GPL-2.0-only
11 static void ns_debug(struct ns_common *ns, const struct proc_ns_operations *ops) in ns_debug() argument
13 switch (ns->ns_type) { in ns_debug()
56 int __ns_common_init(struct ns_common *ns, u32 ns_type, const struct proc_ns_operations *ops, int i… in __ns_common_init() argument
60 refcount_set(&ns->__ns_ref, 1); in __ns_common_init()
61 ns->stashed = NULL; in __ns_common_init()
62 ns->ops = ops; in __ns_common_init()
63 ns->ns_id = 0; in __ns_common_init()
64 ns->ns_type = ns_type; in __ns_common_init()
65 ns_tree_node_init(&ns->ns_tree_node); in __ns_common_init()
66 ns_tree_node_init(&ns->ns_unified_node); in __ns_common_init()
67 ns_tree_node_init(&ns->ns_owner_node); in __ns_common_init()
68 ns_tree_root_init(&ns->ns_owner_root); in __ns_common_init()
71 ns_debug(ns, ops); in __ns_common_init()
75 ns->inum = inum; in __ns_common_init()
77 ret = proc_alloc_inum(&ns->inum); in __ns_common_init()
85 if (is_ns_init_inum(ns)) in __ns_common_init()
86 atomic_set(&ns->__ns_ref_active, 1); in __ns_common_init()
88 atomic_set(&ns->__ns_ref_active, 0); in __ns_common_init()
92 void __ns_common_free(struct ns_common *ns) in __ns_common_free() argument
94 proc_free_inum(ns->inum); in __ns_common_free()
97 struct ns_common *__must_check ns_owner(struct ns_common *ns) in ns_owner() argument
101 if (unlikely(!ns->ops)) in ns_owner()
103 VFS_WARN_ON_ONCE(!ns->ops->owner); in ns_owner()
104 owner = ns->ops->owner(ns); in ns_owner()
105 VFS_WARN_ON_ONCE(!owner && ns != to_ns_common(&init_user_ns)); in ns_owner()
123 * - : dropping active reference
148 * - -
153 * + - +
164 void __ns_ref_active_put(struct ns_common *ns) in __ns_ref_active_put() argument
167 if (is_ns_init_id(ns)) in __ns_ref_active_put()
170 if (!atomic_dec_and_test(&ns->__ns_ref_active)) { in __ns_ref_active_put()
171 VFS_WARN_ON_ONCE(__ns_ref_active_read(ns) < 0); in __ns_ref_active_put()
175 VFS_WARN_ON_ONCE(is_ns_init_id(ns)); in __ns_ref_active_put()
176 VFS_WARN_ON_ONCE(!__ns_ref_read(ns)); in __ns_ref_active_put()
179 ns = ns_owner(ns); in __ns_ref_active_put()
180 if (!ns) in __ns_ref_active_put()
182 VFS_WARN_ON_ONCE(is_ns_init_id(ns)); in __ns_ref_active_put()
183 if (!atomic_dec_and_test(&ns->__ns_ref_active)) { in __ns_ref_active_put()
184 VFS_WARN_ON_ONCE(__ns_ref_active_read(ns) < 0); in __ns_ref_active_put()
200 * - : dropping active reference
225 * - -
230 * + - +
242 * - -
247 * - - -
259 * + -
264 * - + -
282 void __ns_ref_active_get(struct ns_common *ns) in __ns_ref_active_get() argument
287 if (is_ns_init_id(ns)) in __ns_ref_active_get()
291 prev = atomic_fetch_add(1, &ns->__ns_ref_active); in __ns_ref_active_get()
301 ns = ns_owner(ns); in __ns_ref_active_get()
302 if (!ns) in __ns_ref_active_get()
305 VFS_WARN_ON_ONCE(is_ns_init_id(ns)); in __ns_ref_active_get()
306 prev = atomic_fetch_add(1, &ns->__ns_ref_active); in __ns_ref_active_get()