Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern sysctl_kern_proc_args: fix the deadlock (hi joerg!).
details: https://anonhg.NetBSD.org/src/rev/85145188b53b
branches: trunk
changeset: 763843:85145188b53b
user: rmind <rmind%NetBSD.org@localhost>
date: Tue Apr 05 09:02:23 2011 +0000
description:
sysctl_kern_proc_args: fix the deadlock (hi joerg!).
diffstat:
sys/kern/kern_proc.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (31 lines):
diff -r 6cdf6e3fe1fc -r 85145188b53b sys/kern/kern_proc.c
--- a/sys/kern/kern_proc.c Tue Apr 05 08:51:05 2011 +0000
+++ b/sys/kern/kern_proc.c Tue Apr 05 09:02:23 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_proc.c,v 1.173 2011/03/05 01:52:18 matt Exp $ */
+/* $NetBSD: kern_proc.c,v 1.174 2011/04/05 09:02:23 rmind Exp $ */
/*-
* Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.173 2011/03/05 01:52:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.174 2011/04/05 09:02:23 rmind Exp $");
#ifdef _KERNEL_OPT
#include "opt_kstack.h"
@@ -1940,8 +1940,11 @@
goto out_locked;
}
- rw_enter(&p->p_reflock, RW_READER);
+ error = rw_tryenter(&p->p_reflock, RW_READER) ? 0 : EBUSY;
mutex_exit(p->p_lock);
+ if (error) {
+ goto out_locked;
+ }
mutex_exit(proc_lock);
if (type == KERN_PROC_NARGV || type == KERN_PROC_NENV) {
Home |
Main Index |
Thread Index |
Old Index