]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
- Add a new global mutex 'ppeers_lock' to protect the p_peers list of
authorJohn Baldwin <jhb@FreeBSD.org>
Tue, 15 Oct 2002 00:14:32 +0000 (00:14 +0000)
committerJohn Baldwin <jhb@FreeBSD.org>
Tue, 15 Oct 2002 00:14:32 +0000 (00:14 +0000)
commitc65440644e38f43606b6ddfd894a2c08ca3c8969
treed9e7f15a07b01e094393816a21e214800c2bec47
parent60a6965a88ac54f35a0b1f9562b5191657d74d04
- Add a new global mutex 'ppeers_lock' to protect the p_peers list of
  processes forked with RFTHREAD.
- Use a goto to a label for common code when exiting from fork1() in case
  of an error.
- Move the RFTHREAD linkage setup code later in fork since the ppeers_lock
  cannot be locked while holding a proc lock.  Handle the race of a task
  leader exiting and killing its peers while a peer is forking a new child.
  In that case, go ahead and let the peer process proceed normally as the
  parent is about to kill it.  However, the task leader may have already
  gone to sleep to wait for the peers to die, so the new child process may
  not receive a SIGKILL from the task leader.  Rather than try to destruct
  the new child process, just go ahead and send it a SIGKILL directly and
  add it to the p_peers list.  This ensures that the task leader will wait
  until both the peer process doing the fork() and the new child process
  have received their KILL signals and exited.

Discussed with: truckman (earlier versions)
sys/kern/kern_exit.c
sys/kern/kern_fork.c
sys/kern/kern_proc.c
sys/sys/proc.h