summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-02-28 20:11:30 +0000
committerjhb <jhb@FreeBSD.org>2006-02-28 20:11:30 +0000
commitf4fef487daf4c65e5dc2847f7578cca52412accc (patch)
tree1909f8479ba53eaed85a33cafdb47aecfcb582d5
parent7f0fea077c1ac3bcae629020a2d76a1776da6165 (diff)
downloadFreeBSD-src-f4fef487daf4c65e5dc2847f7578cca52412accc.zip
FreeBSD-src-f4fef487daf4c65e5dc2847f7578cca52412accc.tar.gz
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
-rw-r--r--sys/sys/proc.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index d21a3e6..aa4a5c0 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -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)); \
OpenPOWER on IntegriCloud