aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSukadev Bhattiprolu <sukadev@us.ibm.com>2007-10-19 02:39:49 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 14:53:37 -0400
commit2894d650cd9715d00ca196c711265819ef6ebd2d (patch)
treedbfe07c3276c2b6aa7d9a4be633da7fa1e12d97b /kernel
parentbaf8f0f82dd79e374bf6fa9e996393df2bae3c21 (diff)
pid namespaces: define and use task_active_pid_ns() wrapper
With multiple pid namespaces, a process is known by some pid_t in every ancestor pid namespace. Every time the process forks, the child process also gets a pid_t in every ancestor pid namespace. While a process is visible in >=1 pid namespaces, it can see pid_t's in only one pid namespace. We call this pid namespace it's "active pid namespace", and it is always the youngest pid namespace in which the process is known. This patch defines and uses a wrapper to find the active pid namespace of a process. The implementation of the wrapper will be changed in when support for multiple pid namespaces are added. Changelog: 2.6.22-rc4-mm2-pidns1: - [Pavel Emelianov, Alexey Dobriyan] Back out the change to use task_active_pid_ns() in child_reaper() since task->nsproxy can be NULL during task exit (so child_reaper() continues to use init_pid_ns). to implement child_reaper() since init_pid_ns.child_reaper to implement child_reaper() since tsk->nsproxy can be NULL during exit. 2.6.21-rc6-mm1: - Rename task_pid_ns() to task_active_pid_ns() to reflect that a process can have multiple pid namespaces. Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> Acked-by: Pavel Emelianov <xemul@openvz.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Cedric Le Goater <clg@fr.ibm.com> Cc: Dave Hansen <haveblue@us.ibm.com> Cc: Serge Hallyn <serue@us.ibm.com> Cc: Herbert Poetzel <herbert@13thfloor.at> Cc: Kirill Korotaev <dev@sw.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/nsproxy.c2
-rw-r--r--kernel/pid.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index ac99837e7a04..e981c61304f1 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -87,7 +87,7 @@ static struct nsproxy *create_new_namespaces(unsigned long flags,
87 goto out_ipc; 87 goto out_ipc;
88 } 88 }
89 89
90 new_nsp->pid_ns = copy_pid_ns(flags, tsk->nsproxy->pid_ns); 90 new_nsp->pid_ns = copy_pid_ns(flags, task_active_pid_ns(tsk));
91 if (IS_ERR(new_nsp->pid_ns)) { 91 if (IS_ERR(new_nsp->pid_ns)) {
92 err = PTR_ERR(new_nsp->pid_ns); 92 err = PTR_ERR(new_nsp->pid_ns);
93 goto out_pid; 93 goto out_pid;
diff --git a/kernel/pid.c b/kernel/pid.c
index 42de9af8c524..78c0dbffde65 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -214,7 +214,7 @@ struct pid *alloc_pid(void)
214 int nr = -1; 214 int nr = -1;
215 struct pid_namespace *ns; 215 struct pid_namespace *ns;
216 216
217 ns = current->nsproxy->pid_ns; 217 ns = task_active_pid_ns(current);
218 pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL); 218 pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL);
219 if (!pid) 219 if (!pid)
220 goto out; 220 goto out;
@@ -364,7 +364,7 @@ struct pid *find_ge_pid(int nr)
364 pid = find_pid(nr); 364 pid = find_pid(nr);
365 if (pid) 365 if (pid)
366 break; 366 break;
367 nr = next_pidmap(current->nsproxy->pid_ns, nr); 367 nr = next_pidmap(task_active_pid_ns(current), nr);
368 } while (nr > 0); 368 } while (nr > 0);
369 369
370 return pid; 370 return pid;