de_thread: fix lockless do_each_thread
Subsystems (2)
PATCH RESEND 1/1 de_thread: fix lockless do_each_thread
We should keep the value of old_leader->tasks.next in de_thread, otherwise we can't do for_each_process/do_each_thread without tasklist_lock held.
Signed-off-by Oleg Nesterov <[email protected]>
fs/exec.c renamed from fs/exec.c~3_RCU +1 -2
@@ -706,7 +706,7 @@ static int de_thread(struct task_structattach_pid (current,PIDTYPE_PID , current->pid);attach_pid (current,PIDTYPE_PGID , current->signal->pgrp);attach_pid (current,PIDTYPE_SID , current->signal->session); -list_add_tail_rcu (¤t->tasks, &init_task.tasks); +list_replace_rcu (&leader->tasks, ¤t->tasks); current->group_leader = current; leader->group_leader = current;
@@ -714,7 +714,6 @@ static int de_thread(struct task_struct/* Reduce leader to a thread */ detach_pid (leader,PIDTYPE_PGID );detach_pid (leader,PIDTYPE_SID ); -list_del_init (&leader->tasks); current->exit_signal =SIGCHLD ;