Giant clean up for exit(2)

-Change unconditional aquisition of Giant to only pickup Giant if the vnode
 for the controlling tty resides on a non-mpsafe file system.
-Pickup Giant around executable vnode reference counting operations only if
 the executable resides on a non-mpsafe file system.
-If this process is being traced, pickup Giant for trace file reference count
 operations only if it resides on a non-mpsafe file system.

Discussed with:	jhb
Tested by:	kris
This commit is contained in:
Christian S.J. Peron 2005-11-08 17:11:03 +00:00
parent 744e43465f
commit 576068804d

View File

@ -118,7 +118,7 @@ exit1(struct thread *td, int rv)
struct ucred *tracecred;
#endif
struct plimit *plim;
int refcnt;
int locked, refcnt;
/*
* Drop Giant if caller has it. Eventually we should warn about
@ -303,13 +303,13 @@ exit1(struct thread *td, int rv)
vm_map_max(&vm->vm_map));
}
mtx_lock(&Giant);
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,
@ -355,6 +355,7 @@ 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;
@ -363,7 +364,6 @@ 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
/*
* release trace file
@ -378,9 +378,9 @@ exit1(struct thread *td, int rv)
mtx_unlock(&ktrace_mtx);
PROC_UNLOCK(p);
if (tracevp != NULL) {
mtx_lock(&Giant);
locked = VFS_LOCK_GIANT(tracevp->v_mount);
vrele(tracevp);
mtx_unlock(&Giant);
VFS_UNLOCK_GIANT(locked);
}
if (tracecred != NULL)
crfree(tracecred);
@ -390,9 +390,9 @@ exit1(struct thread *td, int rv)
*/
if ((vtmp = p->p_textvp) != NULL) {
p->p_textvp = NULL;
mtx_lock(&Giant);
locked = VFS_LOCK_GIANT(vtmp->v_mount);
vrele(vtmp);
mtx_unlock(&Giant);
VFS_UNLOCK_GIANT(locked);
}
/*