Back out one of the Giant removals from revision 1.272. Giant was not here to

protect the vnode, it was present to synchronize access to TTY session
information between exit(2) and the TTY code. While we are here, note that
Giant is required for TTY protection.

Clue from:	bde
Discussed with:	jhb
MFC after:	1 week
This commit is contained in:
Christian S.J. Peron 2006-09-13 15:47:53 +00:00
parent 85bfbb5f09
commit 7ca6b7823d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=162284

View File

@ -301,13 +301,13 @@ exit1(struct thread *td, int rv)
vmspace_exit(td);
mtx_lock(&Giant); /* XXX TTY */
sx_xlock(&proctree_lock);
if (SESS_LEADER(p)) {
struct session *sp;
sp = p->p_session;
if (sp->s_ttyvp) {
locked = VFS_LOCK_GIANT(sp->s_ttyvp->v_mount);
/*
* Controlling process.
* Signal foreground pgrp,
@ -353,7 +353,6 @@ exit1(struct thread *td, int rv)
* that the session once had a controlling terminal.
* (for logging and informational purposes)
*/
VFS_UNLOCK_GIANT(locked);
}
SESS_LOCK(p->p_session);
sp->s_leader = NULL;
@ -362,6 +361,7 @@ exit1(struct thread *td, int rv)
fixjobc(p, p->p_pgrp, 0);
sx_xunlock(&proctree_lock);
(void)acct_process(td);
mtx_unlock(&Giant);
#ifdef KTRACE
/*
* Drain any pending records on the thread and release the trace