Lines Matching refs:ns
56 .ns = &init_pid_ns,
80 .ns.inum = PROC_PID_INIT_INO,
82 .ns.ops = &pidns_operations,
105 struct pid_namespace *ns; in put_pid() local
110 ns = pid->numbers[pid->level].ns; in put_pid()
112 kmem_cache_free(ns->pid_cachep, pid); in put_pid()
113 put_pid_ns(ns); in put_pid()
133 struct pid_namespace *ns = upid->ns; in free_pid() local
134 switch (--ns->pid_allocated) { in free_pid()
141 wake_up_process(ns->child_reaper); in free_pid()
145 WARN_ON(ns->child_reaper); in free_pid()
146 ns->pid_allocated = 0; in free_pid()
149 schedule_work(&ns->proc_work); in free_pid()
153 idr_remove(&ns->idr, upid->nr); in free_pid()
160 struct pid *alloc_pid(struct pid_namespace *ns) in alloc_pid() argument
169 pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL); in alloc_pid()
173 tmp = ns; in alloc_pid()
174 pid->level = ns->level; in alloc_pid()
176 for (i = ns->level; i >= 0; i--) { in alloc_pid()
204 pid->numbers[i].ns = tmp; in alloc_pid()
209 if (pid_ns_prepare_proc(ns)) in alloc_pid()
213 get_pid_ns(ns); in alloc_pid()
220 upid = pid->numbers + ns->level; in alloc_pid()
222 if (!(ns->pid_allocated & PIDNS_ADDING)) in alloc_pid()
226 idr_replace(&upid->ns->idr, pid, upid->nr); in alloc_pid()
227 upid->ns->pid_allocated++; in alloc_pid()
235 put_pid_ns(ns); in alloc_pid()
239 while (++i <= ns->level) { in alloc_pid()
241 idr_remove(&upid->ns->idr, upid->nr); in alloc_pid()
245 if (ns->pid_allocated == PIDNS_ADDING) in alloc_pid()
246 idr_set_cursor(&ns->idr, 0); in alloc_pid()
250 kmem_cache_free(ns->pid_cachep, pid); in alloc_pid()
254 void disable_pid_allocation(struct pid_namespace *ns) in disable_pid_allocation() argument
257 ns->pid_allocated &= ~PIDNS_ADDING; in disable_pid_allocation()
261 struct pid *find_pid_ns(int nr, struct pid_namespace *ns) in find_pid_ns() argument
263 return idr_find(&ns->idr, nr); in find_pid_ns()
346 struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns) in find_task_by_pid_ns() argument
350 return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID); in find_task_by_pid_ns()
405 pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns) in pid_nr_ns() argument
410 if (pid && ns->level <= pid->level) { in pid_nr_ns()
411 upid = &pid->numbers[ns->level]; in pid_nr_ns()
412 if (upid->ns == ns) in pid_nr_ns()
426 struct pid_namespace *ns) in __task_pid_nr_ns() argument
431 if (!ns) in __task_pid_nr_ns()
432 ns = task_active_pid_ns(current); in __task_pid_nr_ns()
434 nr = pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns); in __task_pid_nr_ns()
452 struct pid *find_ge_pid(int nr, struct pid_namespace *ns) in find_ge_pid() argument
454 return idr_get_next(&ns->idr, &nr); in find_ge_pid()