aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2011-03-24 18:40:11 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2011-03-24 18:40:11 +0000
commit8e6fa660f2c1f211fc86935cd1a7860e817af057 (patch)
treeb8f82913909a64d0acd11bf6bd0728bcb4cc6c84 /sys/compat
parent3bf92decd3e03e997e35e4b4d045fd35cb641e53 (diff)
downloadsrc-8e6fa660f2c1f211fc86935cd1a7860e817af057.tar.gz
src-8e6fa660f2c1f211fc86935cd1a7860e817af057.zip
Fix some locking nits with the p_state field of struct proc:
- Hold the proc lock while changing the state from PRS_NEW to PRS_NORMAL in fork to honor the locking requirements. While here, expand the scope of the PROC_LOCK() on the new process (p2) to avoid some LORs. Previously the code was locking the new child process (p2) after it had locked the parent process (p1). However, when locking two processes, the safe order is to lock the child first, then the parent. - Fix various places that were checking p_state against PRS_NEW without having the process locked to use PROC_LOCK(). Every place was already locking the process, just after the PRS_NEW check. - Remove or reduce the use of PROC_SLOCK() for places that were checking p_state against PRS_NEW. The PROC_LOCK() alone is sufficient for reading the current state. - Reorder fill_kinfo_proc() slightly so it only acquires PROC_SLOCK() once. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=219968
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linprocfs/linprocfs.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index 3ff9443eca25..b3d4e9ca4d6b 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -740,7 +740,6 @@ linprocfs_doprocstatus(PFS_FILL_ARGS)
if (P_SHOULDSTOP(p)) {
state = "T (stopped)";
} else {
- PROC_SLOCK(p);
switch(p->p_state) {
case PRS_NEW:
state = "I (idle)";
@@ -770,7 +769,6 @@ linprocfs_doprocstatus(PFS_FILL_ARGS)
state = "? (unknown)";
break;
}
- PROC_SUNLOCK(p);
}
fill_kinfo_proc(p, &kp);