summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2004-03-14 02:06:28 +0000
committerpeter <peter@FreeBSD.org>2004-03-14 02:06:28 +0000
commitbd5efd46002ab435a3543c06a8463f93bf87b51e (patch)
tree571f9f9ac088cad74d9e9b00d76e0dc2eab6f9f4
parent963c36c1956c741c098e14e7f7708ac1d78e187e (diff)
downloadFreeBSD-src-bd5efd46002ab435a3543c06a8463f93bf87b51e.zip
FreeBSD-src-bd5efd46002ab435a3543c06a8463f93bf87b51e.tar.gz
Make the process_exit eventhandler run without Giant. Add Giant hooks
in the two consumers that need it.. processes using AIO and netncp. Update docs. Say that process_exec is called with Giant, but not to depend on it. All our consumers can handle it without Giant.
-rw-r--r--sys/kern/kern_exec.c1
-rw-r--r--sys/kern/kern_exit.c2
-rw-r--r--sys/kern/kern_fork.c2
-rw-r--r--sys/kern/vfs_aio.c2
-rw-r--r--sys/netncp/ncp_subr.c2
-rw-r--r--sys/sys/eventhandler.h4
6 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index a09dba2..d9f7449 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -843,6 +843,7 @@ exec_new_vmspace(imgp, sv)
imgp->vmspace_destroyed = 1;
+ /* Called with Giant held, do not depend on it! */
EVENTHANDLER_INVOKE(process_exec, p);
/*
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 885404e..dec3a97 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -214,9 +214,7 @@ exit1(struct thread *td, int rv)
* e.g. SYSV IPC stuff
* XXX what if one of these generates an error?
*/
- mtx_lock(&Giant);
EVENTHANDLER_INVOKE(process_exit, p);
- mtx_unlock(&Giant);
MALLOC(p->p_ru, struct rusage *, sizeof(struct rusage),
M_ZOMBIE, M_WAITOK);
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index bd17f05..ec4caef 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -695,8 +695,6 @@ again:
* Both processes are set up, now check if any loadable modules want
* to adjust anything.
* What if they have an error? XXX
- *
- * Handlers must be MPSAFE, or aquire Giant themselves if not.
*/
EVENTHANDLER_INVOKE(process_fork, p1, p2, flags);
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index d51d3fc..8c21215 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -543,6 +543,7 @@ aio_proc_rundown(void *arg, struct proc *p)
if (ki == NULL)
return;
+ mtx_lock(&Giant);
ki->kaio_flags |= LIOJ_SIGNAL_POSTED;
while ((ki->kaio_active_count > 0) || (ki->kaio_buffer_count >
ki->kaio_buffer_finished_count)) {
@@ -643,6 +644,7 @@ restart4:
uma_zfree(kaio_zone, ki);
p->p_aioinfo = NULL;
+ mtx_unlock(&Giant);
}
/*
diff --git a/sys/netncp/ncp_subr.c b/sys/netncp/ncp_subr.c
index c15b985..b213733 100644
--- a/sys/netncp/ncp_subr.c
+++ b/sys/netncp/ncp_subr.c
@@ -85,6 +85,7 @@ ncp_at_exit(void *arg, struct proc *p)
struct ncp_conn *ncp, *nncp;
struct thread *td;
+ mtx_lock(&Giant);
FOREACH_THREAD_IN_PROC(p, td) {
if (ncp_conn_putprochandles(td) == 0)
continue;
@@ -100,6 +101,7 @@ ncp_at_exit(void *arg, struct proc *p)
}
ncp_conn_unlocklist(td);
}
+ mtx_unlock(&Giant);
}
int
diff --git a/sys/sys/eventhandler.h b/sys/sys/eventhandler.h
index 3f623b2..c734c19 100644
--- a/sys/sys/eventhandler.h
+++ b/sys/sys/eventhandler.h
@@ -158,8 +158,8 @@ EVENTHANDLER_DECLARE(vm_lowmem, vm_lowmem_handler_t);
/*
* Process events
- * process_fork handlers are called without Giant.
- * exit/exec handlers are called with Giant.
+ * process_fork and exit handlers are called without Giant.
+ * exec handlers are called with Giant, but that is by accident.
*/
struct proc;
OpenPOWER on IntegriCloud