path: root/sys/sys/proc.h
diff options
authorRick Macklem <rmacklem@FreeBSD.org>2019-04-15 01:27:15 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2019-04-15 01:27:15 +0000
commiteeb1f3ed51ee4ce72e25e2ffeecc701a1ee09298 (patch)
treeb81fff8120c79322fded7cfeaf5e624ca566e5aa /sys/sys/proc.h
parente3e21edb19b4535dde96a616963cf8ac4e648c13 (diff)
Fix the NFSv4 client to safely find processes.
r340744 broke the NFSv4 client, because it replaced pfind_locked() with a call to pfind(), since pfind() acquires the sx lock for the pid hash and the NFSv4 already holds a mutex when it does the call. The patch fixes the problem by recreating a pfind_any_locked() and adding the functions pidhash_slockall() and pidhash_sunlockall to acquire/release all of the pid hash locks. These functions are then used by the NFSv4 client instead of acquiring the allproc_lock and calling pfind(). Reviewed by: kib, mjg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19887
Notes: svn path=/head/; revision=346217
Diffstat (limited to 'sys/sys/proc.h')
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 53d5cc88d58f..e51caf7c9a35 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -989,8 +989,11 @@ extern struct uma_zone *proc_zone;
struct proc *pfind(pid_t); /* Find process by id. */
struct proc *pfind_any(pid_t); /* Find (zombie) process by id. */
+struct proc *pfind_any_locked(pid_t pid); /* Find process by id, locked. */
struct pgrp *pgfind(pid_t); /* Find process group by id. */
struct proc *zpfind(pid_t); /* Find zombie process by id. */
+void pidhash_slockall(void); /* Shared lock all pid hash lists. */
+void pidhash_sunlockall(void); /* Shared unlock all pid hash lists. */
struct fork_req {
int fr_flags;