diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_descrip.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_proc.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_prot.c | 21 | ||||
-rw-r--r-- | sys/kern/vfs_aio.c | 2 |
4 files changed, 7 insertions, 26 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 9e9f1de..3e15012 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -601,9 +601,7 @@ funsetownlst(sigiolst) PGRP_UNLOCK(pg); SIGIO_UNLOCK(); crfree(sigio->sio_ucred); - mtx_lock(&Giant); FREE(sigio, M_SIGIO); - mtx_unlock(&Giant); SIGIO_LOCK(); PGRP_LOCK(pg); } else /* if (p != NULL) */ { @@ -613,9 +611,7 @@ funsetownlst(sigiolst) PROC_UNLOCK(p); SIGIO_UNLOCK(); crfree(sigio->sio_ucred); - mtx_lock(&Giant); FREE(sigio, M_SIGIO); - mtx_unlock(&Giant); SIGIO_LOCK(); PROC_LOCK(p); } diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index d68c02e..2dde108 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -493,16 +493,12 @@ pgdelete(pgrp) savesess->s_count--; SESS_UNLOCK(savesess); PGRP_UNLOCK(pgrp); - mtx_destroy(&pgrp->pg_mtx); - sx_xunlock(&proctree_lock); /* XXX Until free(9) becomes Giant-free */ - mtx_lock(&Giant); - sx_xlock(&proctree_lock); if (savesess->s_count == 0) { mtx_destroy(&savesess->s_mtx); FREE(pgrp->pg_session, M_SESSION); } + mtx_destroy(&pgrp->pg_mtx); FREE(pgrp, M_PGRP); - mtx_unlock(&Giant); } /* diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 30f8902..e4f9d3a 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -344,10 +344,8 @@ setsid(register struct thread *td, struct setsid_args *uap) error = 0; pgrp = NULL; - mtx_lock(&Giant); MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, M_WAITOK | M_ZERO); - mtx_unlock(&Giant); sx_xlock(&proctree_lock); @@ -364,14 +362,10 @@ setsid(register struct thread *td, struct setsid_args *uap) sx_xunlock(&proctree_lock); - if (newpgrp != NULL || newsess != NULL) { - mtx_lock(&Giant); - if (newpgrp != NULL) - FREE(newpgrp, M_PGRP); - if (newsess != NULL) - FREE(newsess, M_SESSION); - mtx_unlock(&Giant); - } + if (newpgrp != NULL) + FREE(newpgrp, M_PGRP); + if (newsess != NULL) + FREE(newsess, M_SESSION); return (error); } @@ -413,9 +407,7 @@ setpgid(struct thread *td, register struct setpgid_args *uap) error = 0; - mtx_lock(&Giant); MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); - mtx_unlock(&Giant); sx_xlock(&proctree_lock); if (uap->pid != 0 && uap->pid != curp->p_pid) { @@ -479,11 +471,8 @@ done: sx_xunlock(&proctree_lock); KASSERT((error == 0) || (newpgrp != NULL), ("setpgid failed and newpgrp is NULL")); - if (newpgrp != NULL) { - mtx_lock(&Giant); + if (newpgrp != NULL) FREE(newpgrp, M_PGRP); - mtx_unlock(&Giant); - } return (error); } diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 46c227e..499d4b7 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -788,13 +788,13 @@ aio_daemon(void *uproc) fdfree(td); mycp->p_fd = NULL; + mtx_unlock(&Giant); /* The daemon resides in its own pgrp. */ MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, M_WAITOK | M_ZERO); - mtx_unlock(&Giant); sx_xlock(&proctree_lock); enterpgrp(mycp, mycp->p_pid, newpgrp, newsess); sx_xunlock(&proctree_lock); |