diff options
-rw-r--r-- | Documentation/feature-removal-schedule.txt | 18 | ||||
-rw-r--r-- | include/linux/sched.h | 5 | ||||
-rw-r--r-- | init/main.c | 2 | ||||
-rw-r--r-- | kernel/kthread.c | 2 | ||||
-rw-r--r-- | kernel/pid.c | 6 |
5 files changed, 24 insertions, 9 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 599fe55bf297..3c35d452b1a9 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -138,6 +138,24 @@ Who: Kay Sievers <kay.sievers@suse.de> | |||
138 | 138 | ||
139 | --------------------------- | 139 | --------------------------- |
140 | 140 | ||
141 | What: find_task_by_pid | ||
142 | When: 2.6.26 | ||
143 | Why: With pid namespaces, calling this funciton will return the | ||
144 | wrong task when called from inside a namespace. | ||
145 | |||
146 | The best way to save a task pid and find a task by this | ||
147 | pid later, is to find this task's struct pid pointer (or get | ||
148 | it directly from the task) and call pid_task() later. | ||
149 | |||
150 | If someone really needs to get a task by its pid_t, then | ||
151 | he most likely needs the find_task_by_vpid() to get the | ||
152 | task from the same namespace as the current task is in, but | ||
153 | this may be not so in general. | ||
154 | |||
155 | Who: Pavel Emelyanov <xemul@openvz.org> | ||
156 | |||
157 | --------------------------- | ||
158 | |||
141 | What: ACPI procfs interface | 159 | What: ACPI procfs interface |
142 | When: July 2008 | 160 | When: July 2008 |
143 | Why: ACPI sysfs conversion should be finished by January 2008. | 161 | Why: ACPI sysfs conversion should be finished by January 2008. |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 86e60796db62..03c238088aee 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1677,7 +1677,10 @@ extern struct pid_namespace init_pid_ns; | |||
1677 | extern struct task_struct *find_task_by_pid_type_ns(int type, int pid, | 1677 | extern struct task_struct *find_task_by_pid_type_ns(int type, int pid, |
1678 | struct pid_namespace *ns); | 1678 | struct pid_namespace *ns); |
1679 | 1679 | ||
1680 | extern struct task_struct *find_task_by_pid(pid_t nr); | 1680 | static inline struct task_struct *__deprecated find_task_by_pid(pid_t nr) |
1681 | { | ||
1682 | return find_task_by_pid_type_ns(PIDTYPE_PID, nr, &init_pid_ns); | ||
1683 | } | ||
1681 | extern struct task_struct *find_task_by_vpid(pid_t nr); | 1684 | extern struct task_struct *find_task_by_vpid(pid_t nr); |
1682 | extern struct task_struct *find_task_by_pid_ns(pid_t nr, | 1685 | extern struct task_struct *find_task_by_pid_ns(pid_t nr, |
1683 | struct pid_namespace *ns); | 1686 | struct pid_namespace *ns); |
diff --git a/init/main.c b/init/main.c index 1f4406477f83..dff253cfcd9f 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -459,7 +459,7 @@ static void noinline __init_refok rest_init(void) | |||
459 | kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND); | 459 | kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND); |
460 | numa_default_policy(); | 460 | numa_default_policy(); |
461 | pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES); | 461 | pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES); |
462 | kthreadd_task = find_task_by_pid(pid); | 462 | kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns); |
463 | unlock_kernel(); | 463 | unlock_kernel(); |
464 | 464 | ||
465 | /* | 465 | /* |
diff --git a/kernel/kthread.c b/kernel/kthread.c index ac72eea48339..bd1b9ea024e1 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
@@ -98,7 +98,7 @@ static void create_kthread(struct kthread_create_info *create) | |||
98 | struct sched_param param = { .sched_priority = 0 }; | 98 | struct sched_param param = { .sched_priority = 0 }; |
99 | wait_for_completion(&create->started); | 99 | wait_for_completion(&create->started); |
100 | read_lock(&tasklist_lock); | 100 | read_lock(&tasklist_lock); |
101 | create->result = find_task_by_pid(pid); | 101 | create->result = find_task_by_pid_ns(pid, &init_pid_ns); |
102 | read_unlock(&tasklist_lock); | 102 | read_unlock(&tasklist_lock); |
103 | /* | 103 | /* |
104 | * root may have changed our (kthreadd's) priority or CPU mask. | 104 | * root may have changed our (kthreadd's) priority or CPU mask. |
diff --git a/kernel/pid.c b/kernel/pid.c index b322cdf401bf..a9ae9f7fb229 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -381,12 +381,6 @@ struct task_struct *find_task_by_pid_type_ns(int type, int nr, | |||
381 | 381 | ||
382 | EXPORT_SYMBOL(find_task_by_pid_type_ns); | 382 | EXPORT_SYMBOL(find_task_by_pid_type_ns); |
383 | 383 | ||
384 | struct task_struct *find_task_by_pid(pid_t nr) | ||
385 | { | ||
386 | return find_task_by_pid_type_ns(PIDTYPE_PID, nr, &init_pid_ns); | ||
387 | } | ||
388 | EXPORT_SYMBOL(find_task_by_pid); | ||
389 | |||
390 | struct task_struct *find_task_by_vpid(pid_t vnr) | 384 | struct task_struct *find_task_by_vpid(pid_t vnr) |
391 | { | 385 | { |
392 | return find_task_by_pid_type_ns(PIDTYPE_PID, vnr, | 386 | return find_task_by_pid_type_ns(PIDTYPE_PID, vnr, |