summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2005-11-08 17:11:03 +0000
committercsjp <csjp@FreeBSD.org>2005-11-08 17:11:03 +0000
commit62ab0fa06267ba40af67960e13afce8dfc36bc46 (patch)
treeec9239c3f8bd4fa2c8ff62ae972b35c69fd87679 /sys/kern
parentdea22f2914aedd87e7e2f80cdef048aa1b2bf217 (diff)
downloadFreeBSD-src-62ab0fa06267ba40af67960e13afce8dfc36bc46.zip
FreeBSD-src-62ab0fa06267ba40af67960e13afce8dfc36bc46.tar.gz
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
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_exit.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 191bb7c..46f411f 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -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 @@ retry:
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 @@ retry:
* 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 @@ retry:
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 @@ retry:
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 @@ retry:
*/
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);
}
/*
OpenPOWER on IntegriCloud