提交 9b678ece 编写于 作者: O Oleg Nesterov 提交者: Linus Torvalds

[PATCH] don't use REMOVE_LINKS/SET_LINKS for reparenting

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: NOleg Nesterov <oleg@tv-sign.ru>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 8fafabd8
...@@ -238,10 +238,10 @@ static void reparent_to_init(void) ...@@ -238,10 +238,10 @@ static void reparent_to_init(void)
ptrace_unlink(current); ptrace_unlink(current);
/* Reparent to init */ /* Reparent to init */
REMOVE_LINKS(current); remove_parent(current);
current->parent = child_reaper; current->parent = child_reaper;
current->real_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 */ /* Set the exit signal to SIGCHLD so we signal init on exit */
current->exit_signal = SIGCHLD; current->exit_signal = SIGCHLD;
......
...@@ -35,9 +35,9 @@ void __ptrace_link(task_t *child, task_t *new_parent) ...@@ -35,9 +35,9 @@ void __ptrace_link(task_t *child, task_t *new_parent)
if (child->parent == new_parent) if (child->parent == new_parent)
return; return;
list_add(&child->ptrace_list, &child->parent->ptrace_children); list_add(&child->ptrace_list, &child->parent->ptrace_children);
REMOVE_LINKS(child); remove_parent(child);
child->parent = new_parent; child->parent = new_parent;
SET_LINKS(child); add_parent(child);
} }
/* /*
...@@ -77,9 +77,9 @@ void __ptrace_unlink(task_t *child) ...@@ -77,9 +77,9 @@ void __ptrace_unlink(task_t *child)
child->ptrace = 0; child->ptrace = 0;
if (!list_empty(&child->ptrace_list)) { if (!list_empty(&child->ptrace_list)) {
list_del_init(&child->ptrace_list); list_del_init(&child->ptrace_list);
REMOVE_LINKS(child); remove_parent(child);
child->parent = child->real_parent; child->parent = child->real_parent;
SET_LINKS(child); add_parent(child);
} }
ptrace_untrace(child); ptrace_untrace(child);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册