public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -mm, resend] de_thread: fix lockless do_each_thread
@ 2006-05-14 18:45 Oleg Nesterov
  0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2006-05-14 18:45 UTC (permalink / raw)
  To: Andrew Morton, Eric W. Biederman; +Cc: linux-kernel

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 <oleg@tv-sign.ru>

--- MM/fs/exec.c~3_RCU	2006-05-14 22:14:42.000000000 +0400
+++ MM/fs/exec.c	2006-05-14 22:32:13.000000000 +0400
@@ -706,7 +706,7 @@ static int de_thread(struct task_struct 
 		attach_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(&current->tasks, &init_task.tasks);
+		list_replace_rcu(&leader->tasks, &current->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;
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-14 14:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-14 18:45 [PATCH -mm, resend] de_thread: fix lockless do_each_thread Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox