public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@osdl.org>
Cc: ebiederm@xmission.com, torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] de_thread: Don't confuse users do_each_thread.
Date: Tue, 11 Apr 2006 14:47:00 +0400	[thread overview]
Message-ID: <20060411104700.GA1051@oleg> (raw)
In-Reply-To: <20060410222324.7b9daeef.akpm@osdl.org>

On 04/10, Andrew Morton wrote:
>
> Oleg Nesterov <oleg@tv-sign.ru> wrote:
> >
> >  Currently I don't know how the code looks in -mm tree,
> 
> http://www.zip.com.au/~akpm/linux/patches/stuff/x.bz2 is -mm-as-of-now.

Thanks. Here is the patch:

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

--- mm/fs/exec.c~	2006-04-11 14:31:18.000000000 +0400
+++ mm/fs/exec.c	2006-04-11 14:35:23.000000000 +0400
@@ -725,7 +725,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->parent = current->real_parent = leader->real_parent;
 		leader->parent = leader->real_parent = child_reaper;
@@ -735,7 +735,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);
 
 		add_parent(current);
 		add_parent(leader);


  reply	other threads:[~2006-04-11  6:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-06 22:04 [PATCH rc1-mm] de_thread: fix deadlockable process addition Oleg Nesterov
2006-04-06 22:58 ` Eric W. Biederman
2006-04-07 23:46   ` Oleg Nesterov
2006-04-07 22:51     ` Andrew Morton
2006-04-07 22:56       ` Andrew Morton
2006-04-08  7:55         ` Eric W. Biederman
2006-04-08 17:27           ` Oleg Nesterov
2006-04-08 16:07             ` Eric W. Biederman
2006-04-08 21:13               ` Oleg Nesterov
2006-04-08 21:23                 ` Oleg Nesterov
2006-04-10 22:11                   ` Eric W. Biederman
2006-04-10 23:07             ` [PATCH] de_thread: Don't confuse users do_each_thread Eric W. Biederman
2006-04-10 23:16               ` Eric W. Biederman
2006-04-10 23:52                 ` Ingo Oeser
2006-04-11  6:18                   ` Eric W. Biederman
2006-04-11 10:19                   ` Oleg Nesterov
2006-04-11  7:25                     ` Ingo Oeser
2006-04-11  7:36                       ` Eric W. Biederman
2006-04-11 19:50                         ` Ingo Oeser
2006-04-11 10:05                 ` Oleg Nesterov
2006-04-11  5:23                   ` Andrew Morton
2006-04-11 10:47                     ` Oleg Nesterov [this message]
2006-04-11  6:23                   ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060411104700.GA1051@oleg \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox