Allow PHOLD()'s of curproc even if P_WEXIT is set. Normally we don't want

to allow PHOLD()'s of processes that have P_WEXIT set as once that flag
is set we aren't guaranteed to block in exit1() waiting for the PRELE()
(we might already be past the wait).  However, curproc is a bit of a
special case.  By the time P_WEXIT is set, the process is single-threaded,
so the only thread for which can do a PHOLD(curproc) is the thread
executing in exit1().  The fact that this thread is executing ensures
that the process won't go away before the current hold is released via
PRELE().  This fixes some panics due to kicking off softupdate operations
inside of exit1() after the recent PHOLD changes to fix ptrace/procfs vs
exit races.

MFC after:	1 week
Tested by:	pho
This commit is contained in:
John Baldwin 2006-02-28 20:11:30 +00:00
parent 6f56dcd441
commit eac727ae4a

View File

@ -792,7 +792,8 @@ MALLOC_DECLARE(M_ZOMBIE);
} while (0)
#define _PHOLD(p) do { \
PROC_LOCK_ASSERT((p), MA_OWNED); \
KASSERT(!((p)->p_flag & P_WEXIT), ("PHOLD of exiting process"));\
KASSERT(!((p)->p_flag & P_WEXIT) || (p) == curproc, \
("PHOLD of exiting process")); \
(p)->p_lock++; \
if (((p)->p_sflag & PS_INMEM) == 0) \
faultin((p)); \