mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-12 14:29:28 +00:00
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.
This commit is contained in:
parent
8a412f314e
commit
a5bdcb2a2f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=126941
@ -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);
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
|
@ -695,8 +695,6 @@ fork1(td, flags, pages, procp)
|
||||
* 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);
|
||||
|
||||
|
@ -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 @@ aio_proc_rundown(void *arg, struct proc *p)
|
||||
|
||||
uma_zfree(kaio_zone, ki);
|
||||
p->p_aioinfo = NULL;
|
||||
mtx_unlock(&Giant);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user