aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/fs/exec.c b/fs/exec.c
index a13883903ee9..9f9f931ef949 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -766,9 +766,7 @@ static int de_thread(struct task_struct *tsk)
766 766
767 /* 767 /*
768 * Kill all other threads in the thread group. 768 * Kill all other threads in the thread group.
769 * We must hold tasklist_lock to call zap_other_threads.
770 */ 769 */
771 read_lock(&tasklist_lock);
772 spin_lock_irq(lock); 770 spin_lock_irq(lock);
773 if (signal_group_exit(sig)) { 771 if (signal_group_exit(sig)) {
774 /* 772 /*
@@ -776,21 +774,10 @@ static int de_thread(struct task_struct *tsk)
776 * return so that the signal is processed. 774 * return so that the signal is processed.
777 */ 775 */
778 spin_unlock_irq(lock); 776 spin_unlock_irq(lock);
779 read_unlock(&tasklist_lock);
780 return -EAGAIN; 777 return -EAGAIN;
781 } 778 }
782
783 /*
784 * child_reaper ignores SIGKILL, change it now.
785 * Reparenting needs write_lock on tasklist_lock,
786 * so it is safe to do it under read_lock.
787 */
788 if (unlikely(tsk->group_leader == task_child_reaper(tsk)))
789 task_active_pid_ns(tsk)->child_reaper = tsk;
790
791 sig->group_exit_task = tsk; 779 sig->group_exit_task = tsk;
792 zap_other_threads(tsk); 780 zap_other_threads(tsk);
793 read_unlock(&tasklist_lock);
794 781
795 /* Account for the thread group leader hanging around: */ 782 /* Account for the thread group leader hanging around: */
796 count = thread_group_leader(tsk) ? 1 : 2; 783 count = thread_group_leader(tsk) ? 1 : 2;
@@ -811,7 +798,7 @@ static int de_thread(struct task_struct *tsk)
811 if (!thread_group_leader(tsk)) { 798 if (!thread_group_leader(tsk)) {
812 leader = tsk->group_leader; 799 leader = tsk->group_leader;
813 800
814 sig->notify_count = -1; 801 sig->notify_count = -1; /* for exit_notify() */
815 for (;;) { 802 for (;;) {
816 write_lock_irq(&tasklist_lock); 803 write_lock_irq(&tasklist_lock);
817 if (likely(leader->exit_state)) 804 if (likely(leader->exit_state))
@@ -821,6 +808,8 @@ static int de_thread(struct task_struct *tsk)
821 schedule(); 808 schedule();
822 } 809 }
823 810
811 if (unlikely(task_child_reaper(tsk) == leader))
812 task_active_pid_ns(tsk)->child_reaper = tsk;
824 /* 813 /*
825 * The only record we have of the real-time age of a 814 * The only record we have of the real-time age of a
826 * process, regardless of execs it's done, is start_time. 815 * process, regardless of execs it's done, is start_time.