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>