Date: Wed, 8 Jun 2011 19:58:20 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r222868 - in stable/8/sys: kern vm Message-ID: <201106081958.p58JwKfa044966@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Wed Jun 8 19:58:20 2011 New Revision: 222868 URL: http://svn.freebsd.org/changeset/base/222868 Log: MFC 220390: Fix several places to ignore processes that are not yet fully constructed. Modified: stable/8/sys/kern/kern_clock.c stable/8/sys/kern/kern_ktrace.c stable/8/sys/kern/kern_resource.c stable/8/sys/kern/kern_sig.c stable/8/sys/kern/sched_4bsd.c stable/8/sys/vm/vm_glue.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_clock.c ============================================================================== --- stable/8/sys/kern/kern_clock.c Wed Jun 8 19:45:47 2011 (r222867) +++ stable/8/sys/kern/kern_clock.c Wed Jun 8 19:58:20 2011 (r222868) @@ -201,6 +201,10 @@ deadlkres(void) tryl = 0; FOREACH_PROC_IN_SYSTEM(p) { PROC_LOCK(p); + if (p->p_state == PRS_NEW) { + PROC_UNLOCK(p); + continue; + } FOREACH_THREAD_IN_PROC(p, td) { /* Modified: stable/8/sys/kern/kern_ktrace.c ============================================================================== --- stable/8/sys/kern/kern_ktrace.c Wed Jun 8 19:45:47 2011 (r222867) +++ stable/8/sys/kern/kern_ktrace.c Wed Jun 8 19:58:20 2011 (r222868) @@ -881,7 +881,8 @@ ktrace(td, uap) nfound = 0; LIST_FOREACH(p, &pg->pg_members, p_pglist) { PROC_LOCK(p); - if (p_cansee(td, p) != 0) { + if (p->p_state == PRS_NEW || + p_cansee(td, p) != 0) { PROC_UNLOCK(p); continue; } Modified: stable/8/sys/kern/kern_resource.c ============================================================================== --- stable/8/sys/kern/kern_resource.c Wed Jun 8 19:45:47 2011 (r222867) +++ stable/8/sys/kern/kern_resource.c Wed Jun 8 19:58:20 2011 (r222868) @@ -128,7 +128,8 @@ getpriority(td, uap) sx_sunlock(&proctree_lock); LIST_FOREACH(p, &pg->pg_members, p_pglist) { PROC_LOCK(p); - if (p_cansee(td, p) == 0) { + if (p->p_state == PRS_NORMAL && + p_cansee(td, p) == 0) { if (p->p_nice < low) low = p->p_nice; } @@ -214,7 +215,8 @@ setpriority(td, uap) sx_sunlock(&proctree_lock); LIST_FOREACH(p, &pg->pg_members, p_pglist) { PROC_LOCK(p); - if (p_cansee(td, p) == 0) { + if (p->p_state == PRS_NORMAL && + p_cansee(td, p) == 0) { error = donice(td, p, uap->prio); found++; } @@ -229,7 +231,8 @@ setpriority(td, uap) sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { PROC_LOCK(p); - if (p->p_ucred->cr_uid == uap->who && + if (p->p_state == PRS_NORMAL && + p->p_ucred->cr_uid == uap->who && p_cansee(td, p) == 0) { error = donice(td, p, uap->prio); found++; Modified: stable/8/sys/kern/kern_sig.c ============================================================================== --- stable/8/sys/kern/kern_sig.c Wed Jun 8 19:45:47 2011 (r222867) +++ stable/8/sys/kern/kern_sig.c Wed Jun 8 19:58:20 2011 (r222868) @@ -1827,7 +1827,8 @@ pgsignal(struct pgrp *pgrp, int sig, int PGRP_LOCK_ASSERT(pgrp, MA_OWNED); LIST_FOREACH(p, &pgrp->pg_members, p_pglist) { PROC_LOCK(p); - if (checkctty == 0 || p->p_flag & P_CONTROLT) + if (p->p_state == PRS_NORMAL && + (checkctty == 0 || p->p_flag & P_CONTROLT)) pksignal(p, sig, ksi); PROC_UNLOCK(p); } @@ -3223,7 +3224,8 @@ pgsigio(sigiop, sig, checkctty) PGRP_LOCK(sigio->sio_pgrp); LIST_FOREACH(p, &sigio->sio_pgrp->pg_members, p_pglist) { PROC_LOCK(p); - if (CANSIGIO(sigio->sio_ucred, p->p_ucred) && + if (p->p_state == PRS_NORMAL && + CANSIGIO(sigio->sio_ucred, p->p_ucred) && (checkctty == 0 || (p->p_flag & P_CONTROLT))) psignal(p, sig); PROC_UNLOCK(p); Modified: stable/8/sys/kern/sched_4bsd.c ============================================================================== --- stable/8/sys/kern/sched_4bsd.c Wed Jun 8 19:45:47 2011 (r222867) +++ stable/8/sys/kern/sched_4bsd.c Wed Jun 8 19:58:20 2011 (r222868) @@ -457,6 +457,10 @@ schedcpu(void) sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { PROC_LOCK(p); + if (p->p_state == PRS_NEW) { + PROC_UNLOCK(p); + continue; + } FOREACH_THREAD_IN_PROC(p, td) { awake = 0; thread_lock(td); Modified: stable/8/sys/vm/vm_glue.c ============================================================================== --- stable/8/sys/vm/vm_glue.c Wed Jun 8 19:45:47 2011 (r222867) +++ stable/8/sys/vm/vm_glue.c Wed Jun 8 19:58:20 2011 (r222868) @@ -766,7 +766,8 @@ loop: sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { PROC_LOCK(p); - if (p->p_flag & (P_SWAPPINGOUT | P_SWAPPINGIN | P_INMEM)) { + if (p->p_state == PRS_NEW || + p->p_flag & (P_SWAPPINGOUT | P_SWAPPINGIN | P_INMEM)) { PROC_UNLOCK(p); continue; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106081958.p58JwKfa044966>