diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-02-07 03:14:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:22 -0500 |
commit | 73507f335f406ff31ceb97b39fa76eaee00f4f26 (patch) | |
tree | 0fc2afdd433f883525195c337150140a692a8170 | |
parent | b450129554213a4d4c5932f8a293646c029e1b0a (diff) |
Handle pid namespaces in cgroups code
There's one place that works with task pids - its the "tasks" file in cgroups.
The read/write handlers assume, that the pid values go to/come from the user
space and thus it is a virtual pid, i.e. the pid as it is seen from inside a
namespace.
Tune the code accordingly.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/cgroup.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 2c5cccbe12e2..4766bb65e4d9 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1269,7 +1269,7 @@ static int attach_task_by_pid(struct cgroup *cgrp, char *pidbuf) | |||
1269 | 1269 | ||
1270 | if (pid) { | 1270 | if (pid) { |
1271 | rcu_read_lock(); | 1271 | rcu_read_lock(); |
1272 | tsk = find_task_by_pid(pid); | 1272 | tsk = find_task_by_vpid(pid); |
1273 | if (!tsk || tsk->flags & PF_EXITING) { | 1273 | if (!tsk || tsk->flags & PF_EXITING) { |
1274 | rcu_read_unlock(); | 1274 | rcu_read_unlock(); |
1275 | return -ESRCH; | 1275 | return -ESRCH; |
@@ -1955,7 +1955,7 @@ static int pid_array_load(pid_t *pidarray, int npids, struct cgroup *cgrp) | |||
1955 | while ((tsk = cgroup_iter_next(cgrp, &it))) { | 1955 | while ((tsk = cgroup_iter_next(cgrp, &it))) { |
1956 | if (unlikely(n == npids)) | 1956 | if (unlikely(n == npids)) |
1957 | break; | 1957 | break; |
1958 | pidarray[n++] = task_pid_nr(tsk); | 1958 | pidarray[n++] = task_pid_vnr(tsk); |
1959 | } | 1959 | } |
1960 | cgroup_iter_end(cgrp, &it); | 1960 | cgroup_iter_end(cgrp, &it); |
1961 | return n; | 1961 | return n; |