From: Matt H. <mat...@us...> - 2006-05-17 06:28:47
|
Move the location of the fork notification chain calls because Process Events, which will use Task Notifier, needs the real parent's pid in the task_struct. Index: linux-2.6.17-rc4/kernel/fork.c =================================================================== --- linux-2.6.17-rc4.orig/kernel/fork.c +++ linux-2.6.17-rc4/kernel/fork.c @@ -1120,12 +1120,10 @@ static task_t *copy_process(unsigned lon /* ok, now we should be set up.. */ p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL); p->pdeath_signal = 0; p->exit_state = 0; - if (task_notifier_call_chain(TN_FORK, p)) - goto bad_fork_cleanup_namespace; /* * Ok, make it visible to the rest of the system. * We dont wake it up yet. */ p->group_leader = p; @@ -1158,10 +1156,11 @@ static task_t *copy_process(unsigned lon p->real_parent = current->real_parent; else p->real_parent = current; p->parent = p->real_parent; + spin_lock(¤t->sighand->siglock); /* * Process group and session signals need to be delivered to just the * parent before the fork or both the parent and the child after the @@ -1223,10 +1222,11 @@ static task_t *copy_process(unsigned lon } total_forks++; spin_unlock(¤t->sighand->siglock); write_unlock_irq(&tasklist_lock); + task_notifier_call_chain(TN_FORK, p); proc_fork_connector(p); return p; bad_fork_cleanup_namespace: exit_namespace(p); |