]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fs/exec.c:de_thread(): use change_pid() rather than detach_pid/attach_pid
authorOleg Nesterov <oleg@redhat.com>
Thu, 27 Jun 2013 23:53:53 +0000 (09:53 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 28 Jun 2013 06:38:56 +0000 (16:38 +1000)
de_thread() can use change_pid() instead of detach + attach.  This looks
better and this ensures that, say, next_thread() can never see a task with
->pid == NULL.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Sergey Dyasly <dserrg@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/exec.c

index 03b907cfd76523c690ca7d58ed0448e58ab99b42..7619dddd56220aedf17d96037e94880097c00bd3 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -947,9 +947,8 @@ static int de_thread(struct task_struct *tsk)
                 * Note: The old leader also uses this pid until release_task
                 *       is called.  Odd but simple and correct.
                 */
-               detach_pid(tsk, PIDTYPE_PID);
                tsk->pid = leader->pid;
-               attach_pid(tsk, PIDTYPE_PID,  task_pid(leader));
+               change_pid(tsk, PIDTYPE_PID, task_pid(leader));
                transfer_pid(leader, tsk, PIDTYPE_PGID);
                transfer_pid(leader, tsk, PIDTYPE_SID);