Lines Matching refs:ns

75 	struct pid_namespace *ns = container_of(work, struct pid_namespace, proc_work);  in proc_cleanup_work()  local
76 pid_ns_release_proc(ns); in proc_cleanup_work()
85 struct pid_namespace *ns; in create_pid_namespace() local
96 ns = kmem_cache_zalloc(pid_ns_cachep, GFP_KERNEL); in create_pid_namespace()
97 if (ns == NULL) in create_pid_namespace()
100 ns->pidmap[0].page = kzalloc(PAGE_SIZE, GFP_KERNEL); in create_pid_namespace()
101 if (!ns->pidmap[0].page) in create_pid_namespace()
104 ns->pid_cachep = create_pid_cachep(level + 1); in create_pid_namespace()
105 if (ns->pid_cachep == NULL) in create_pid_namespace()
108 err = ns_alloc_inum(&ns->ns); in create_pid_namespace()
111 ns->ns.ops = &pidns_operations; in create_pid_namespace()
113 kref_init(&ns->kref); in create_pid_namespace()
114 ns->level = level; in create_pid_namespace()
115 ns->parent = get_pid_ns(parent_pid_ns); in create_pid_namespace()
116 ns->user_ns = get_user_ns(user_ns); in create_pid_namespace()
117 ns->nr_hashed = PIDNS_HASH_ADDING; in create_pid_namespace()
118 INIT_WORK(&ns->proc_work, proc_cleanup_work); in create_pid_namespace()
120 set_bit(0, ns->pidmap[0].page); in create_pid_namespace()
121 atomic_set(&ns->pidmap[0].nr_free, BITS_PER_PAGE - 1); in create_pid_namespace()
124 atomic_set(&ns->pidmap[i].nr_free, BITS_PER_PAGE); in create_pid_namespace()
126 return ns; in create_pid_namespace()
129 kfree(ns->pidmap[0].page); in create_pid_namespace()
131 kmem_cache_free(pid_ns_cachep, ns); in create_pid_namespace()
142 static void destroy_pid_namespace(struct pid_namespace *ns) in destroy_pid_namespace() argument
146 ns_free_inum(&ns->ns); in destroy_pid_namespace()
148 kfree(ns->pidmap[i].page); in destroy_pid_namespace()
149 put_user_ns(ns->user_ns); in destroy_pid_namespace()
150 call_rcu(&ns->rcu, delayed_free_pidns); in destroy_pid_namespace()
165 struct pid_namespace *ns; in free_pid_ns() local
167 ns = container_of(kref, struct pid_namespace, kref); in free_pid_ns()
168 destroy_pid_namespace(ns); in free_pid_ns()
171 void put_pid_ns(struct pid_namespace *ns) in put_pid_ns() argument
175 while (ns != &init_pid_ns) { in put_pid_ns()
176 parent = ns->parent; in put_pid_ns()
177 if (!kref_put(&ns->kref, free_pid_ns)) in put_pid_ns()
179 ns = parent; in put_pid_ns()
337 static inline struct pid_namespace *to_pid_ns(struct ns_common *ns) in to_pid_ns() argument
339 return container_of(ns, struct pid_namespace, ns); in to_pid_ns()
344 struct pid_namespace *ns; in pidns_get() local
347 ns = task_active_pid_ns(task); in pidns_get()
348 if (ns) in pidns_get()
349 get_pid_ns(ns); in pidns_get()
352 return ns ? &ns->ns : NULL; in pidns_get()
355 static void pidns_put(struct ns_common *ns) in pidns_put() argument
357 put_pid_ns(to_pid_ns(ns)); in pidns_put()
360 static int pidns_install(struct nsproxy *nsproxy, struct ns_common *ns) in pidns_install() argument
363 struct pid_namespace *ancestor, *new = to_pid_ns(ns); in pidns_install()