Mercurial > illumos > illumos-gate
changeset 12846:80922850cf92
6967895 assertion failed: tk->tk_nprocs == 0, file: ../../common/os/task.c, line 436
author | Menno Lageman <Menno.Lageman@Sun.COM> |
---|---|
date | Thu, 15 Jul 2010 12:37:49 -0700 |
parents | f0e4ac2993aa |
children | e5b18d290ac6 |
files | usr/src/uts/common/os/exit.c usr/src/uts/common/os/fork.c usr/src/uts/common/os/pid.c usr/src/uts/common/sys/proc.h |
diffstat | 4 files changed, 22 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/os/exit.c Thu Jul 15 11:39:44 2010 -0700 +++ b/usr/src/uts/common/os/exit.c Thu Jul 15 12:37:49 2010 -0700 @@ -1200,7 +1200,6 @@ { proc_t *q; task_t *tk; - zone_t *zone; ASSERT(p->p_stat == SZOMB); ASSERT(p->p_tlist == NULL); @@ -1291,21 +1290,13 @@ * The process table slot is being freed, so it is now safe to give up * task and project membership. */ - zone = p->p_zone; mutex_enter(&p->p_lock); tk = p->p_task; task_detach(p); - p->p_task = task0p; mutex_exit(&p->p_lock); proc_detach(p); - pid_exit(p); /* frees pid and proc structure */ - - mutex_enter(&zone->zone_nlwps_lock); - tk->tk_nprocs--; - tk->tk_proj->kpj_nprocs--; - zone->zone_nprocs--; - mutex_exit(&zone->zone_nlwps_lock); + pid_exit(p, tk); /* frees pid and proc structure */ task_rele(tk); }
--- a/usr/src/uts/common/os/fork.c Thu Jul 15 11:39:44 2010 -0700 +++ b/usr/src/uts/common/os/fork.c Thu Jul 15 12:37:49 2010 -0700 @@ -276,7 +276,7 @@ ASSERT(cp->p_pool->pool_ref > 0); atomic_add_32(&cp->p_pool->pool_ref, -1); mutex_exit(&cp->p_lock); - pid_exit(cp); + pid_exit(cp, tk); mutex_exit(&pidlock); task_rele(tk); @@ -641,7 +641,7 @@ cp->p_sibling->p_psibling = cp->p_psibling; if (cp->p_psibling) cp->p_psibling->p_sibling = cp->p_sibling; - pid_exit(cp); + pid_exit(cp, tk); mutex_exit(&pidlock); task_rele(tk); @@ -875,7 +875,7 @@ ASSERT(p->p_pool->pool_ref > 0); atomic_add_32(&p->p_pool->pool_ref, -1); mutex_exit(&p->p_lock); - pid_exit(p); + pid_exit(p, tk); mutex_exit(&pidlock); task_rele(tk);
--- a/usr/src/uts/common/os/pid.c Thu Jul 15 11:39:44 2010 -0700 +++ b/usr/src/uts/common/os/pid.c Thu Jul 15 12:37:49 2010 -0700 @@ -43,6 +43,8 @@ #include <sys/bitmap.h> #include <sys/debug.h> #include <c2/audit.h> +#include <sys/project.h> +#include <sys/task.h> #include <sys/zone.h> /* directory entries for /proc */ @@ -260,10 +262,15 @@ mutex_exit(&pidlinklock); } +/* + * The original task needs to be passed in since the process has already been + * detached from the task at this point in time. + */ void -pid_exit(proc_t *prp) +pid_exit(proc_t *prp, struct task *tk) { struct pid *pidp; + zone_t *zone = prp->p_zone; ASSERT(MUTEX_HELD(&pidlock)); @@ -300,6 +307,15 @@ mutex_destroy(&prp->p_crlock); kmem_cache_free(process_cache, prp); nproc--; + + /* + * Decrement the process counts of the original task, project and zone. + */ + mutex_enter(&zone->zone_nlwps_lock); + tk->tk_nprocs--; + tk->tk_proj->kpj_nprocs--; + zone->zone_nprocs--; + mutex_exit(&zone->zone_nlwps_lock); } /*
--- a/usr/src/uts/common/sys/proc.h Thu Jul 15 11:39:44 2010 -0700 +++ b/usr/src/uts/common/sys/proc.h Thu Jul 15 12:37:49 2010 -0700 @@ -624,7 +624,7 @@ extern void pid_setmin(void); extern pid_t pid_allocate(proc_t *, pid_t, int); extern int pid_rele(struct pid *); -extern void pid_exit(proc_t *); +extern void pid_exit(proc_t *, struct task *); extern void proc_entry_free(struct pid *); extern proc_t *prfind(pid_t); extern proc_t *prfind_zone(pid_t, zoneid_t);