Skip to content

Commit

Permalink
fs/exec.c:de_thread(): use change_pid() rather than detach_pid/attach…
Browse files Browse the repository at this point in the history
…_pid

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 <[email protected]>
Acked-by: "Eric W. Biederman" <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Pavel Emelyanov <[email protected]>
Cc: Sergey Dyasly <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
oleg-nesterov authored and torvalds committed Jul 3, 2013
1 parent 888ffc5 commit 3f41854
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 3f41854

Please sign in to comment.