[PATCH] don't use REMOVE_LINKS/SET_LINKS for reparenting
authorOleg Nesterov <oleg@tv-sign.ru>
Wed, 29 Mar 2006 00:11:05 +0000 (16:11 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 29 Mar 2006 02:36:41 +0000 (18:36 -0800)
There are places where kernel uses REMOVE_LINKS/SET_LINKS while changing
process's ->parent.  Use add_parent/remove_parent instead, they don't abuse
of global process list.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/exit.c
kernel/ptrace.c

index df26c33037d2f8aed94f504ed7ac7c5d30d3a32e..5b5e8b67680e0137d087d62e8a75da1de2594341 100644 (file)
@@ -238,10 +238,10 @@ static void reparent_to_init(void)
 
        ptrace_unlink(current);
        /* Reparent to init */
-       REMOVE_LINKS(current);
+       remove_parent(current);
        current->parent = child_reaper;
        current->real_parent = child_reaper;
-       SET_LINKS(current);
+       add_parent(current);
 
        /* Set the exit signal to SIGCHLD so we signal init on exit */
        current->exit_signal = SIGCHLD;
index d95a72c9279dc2e1110d31c0dadacc39b30b198f..86a7f6c60cb2f2b4652ce671d6cf15268e11e8f8 100644 (file)
@@ -35,9 +35,9 @@ void __ptrace_link(task_t *child, task_t *new_parent)
        if (child->parent == new_parent)
                return;
        list_add(&child->ptrace_list, &child->parent->ptrace_children);
-       REMOVE_LINKS(child);
+       remove_parent(child);
        child->parent = new_parent;
-       SET_LINKS(child);
+       add_parent(child);
 }
  
 /*
@@ -77,9 +77,9 @@ void __ptrace_unlink(task_t *child)
        child->ptrace = 0;
        if (!list_empty(&child->ptrace_list)) {
                list_del_init(&child->ptrace_list);
-               REMOVE_LINKS(child);
+               remove_parent(child);
                child->parent = child->real_parent;
-               SET_LINKS(child);
+               add_parent(child);
        }
 
        ptrace_untrace(child);