Lines Matching refs:ns
54 .ns = &init_pid_ns,
78 .ns.inum = PROC_PID_INIT_INO,
80 .ns.ops = &pidns_operations,
103 struct pid_namespace *ns; in put_pid() local
108 ns = pid->numbers[pid->level].ns; in put_pid()
111 kmem_cache_free(ns->pid_cachep, pid); in put_pid()
112 put_pid_ns(ns); in put_pid()
132 struct pid_namespace *ns = upid->ns; in free_pid() local
133 switch (--ns->pid_allocated) { in free_pid()
140 wake_up_process(ns->child_reaper); in free_pid()
144 WARN_ON(ns->child_reaper); in free_pid()
145 ns->pid_allocated = 0; in free_pid()
148 schedule_work(&ns->proc_work); in free_pid()
152 idr_remove(&ns->idr, upid->nr); in free_pid()
159 struct pid *alloc_pid(struct pid_namespace *ns) in alloc_pid() argument
168 pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL); in alloc_pid()
172 tmp = ns; in alloc_pid()
173 pid->level = ns->level; in alloc_pid()
175 for (i = ns->level; i >= 0; i--) { in alloc_pid()
203 pid->numbers[i].ns = tmp; in alloc_pid()
208 if (pid_ns_prepare_proc(ns)) in alloc_pid()
212 get_pid_ns(ns); in alloc_pid()
217 upid = pid->numbers + ns->level; in alloc_pid()
219 if (!(ns->pid_allocated & PIDNS_ADDING)) in alloc_pid()
223 idr_replace(&upid->ns->idr, pid, upid->nr); in alloc_pid()
224 upid->ns->pid_allocated++; in alloc_pid()
232 put_pid_ns(ns); in alloc_pid()
236 while (++i <= ns->level) in alloc_pid()
237 idr_remove(&ns->idr, (pid->numbers + i)->nr); in alloc_pid()
240 if (ns->pid_allocated == PIDNS_ADDING) in alloc_pid()
241 idr_set_cursor(&ns->idr, 0); in alloc_pid()
245 kmem_cache_free(ns->pid_cachep, pid); in alloc_pid()
249 void disable_pid_allocation(struct pid_namespace *ns) in disable_pid_allocation() argument
252 ns->pid_allocated &= ~PIDNS_ADDING; in disable_pid_allocation()
256 struct pid *find_pid_ns(int nr, struct pid_namespace *ns) in find_pid_ns() argument
258 return idr_find(&ns->idr, nr); in find_pid_ns()
341 struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns) in find_task_by_pid_ns() argument
345 return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID); in find_task_by_pid_ns()
400 pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns) in pid_nr_ns() argument
405 if (pid && ns->level <= pid->level) { in pid_nr_ns()
406 upid = &pid->numbers[ns->level]; in pid_nr_ns()
407 if (upid->ns == ns) in pid_nr_ns()
421 struct pid_namespace *ns) in __task_pid_nr_ns() argument
426 if (!ns) in __task_pid_nr_ns()
427 ns = task_active_pid_ns(current); in __task_pid_nr_ns()
429 nr = pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns); in __task_pid_nr_ns()
447 struct pid *find_ge_pid(int nr, struct pid_namespace *ns) in find_ge_pid() argument
449 return idr_get_next(&ns->idr, &nr); in find_ge_pid()