Fix a number of races in the controlling terminal open/close code.
authorMatthew Dillon <dillon@dragonflybsd.org>
Tue, 3 Jul 2007 17:22:14 +0000 (17:22 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Tue, 3 Jul 2007 17:22:14 +0000 (17:22 +0000)
commitf1aeb0c09b74900e9e96f24334b27c83cc383f9b
tree52f88d773f38923c39a758b6cd87e653aa873a8a
parent6ac00594f54fd23f589cc56a955cd93c95245b30
Fix a number of races in the controlling terminal open/close code.
This does not completely fix issue 715 but it should help reduce the
problem set.

* Integrate the revoke into ttyclosesession() so it can be issued as part
  of the same locking op.
* Check for races after acquiring the vnode lock and retry if necessary.
* Use vhold/vdrop to prevent destruction of the vnode during a possible
  race while we are attempting to obtain the lock.

Reported-by: Thomas Nikolajsen <thomas.nikolajsen@mail.dk> added the comment:
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue715>
sys/kern/kern_exit.c
sys/kern/tty.c
sys/kern/tty_tty.c