• Oleg Nesterov's avatar
    reparent_thread: don't call kill_orphaned_pgrp() if task_detached() · 0a967a04
    Oleg Nesterov authored
    If task_detached(p) == T, then either
    
      a) p is not the main thread, we will find the group leader on the
         ->children list.
    
    or
    
      b) p is the group leader but its ->exit_state = EXIT_DEAD.  This
         can only happen when the last sub-thread has died, but in that case
         that thread has already called kill_orphaned_pgrp() from
         exit_notify().
    
    In both cases kill_orphaned_pgrp() looks bogus.
    
    Move the task_detached() check up and simplify the code, this is also
    right from the "common sense" pov: we should do nothing with the detached
    childs, except move them to the new parent's ->children list.
    Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
    Cc: Roland McGrath <roland@redhat.com>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    0a967a04
exit.c 45.7 KB