summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-08-10 19:19:19 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-08-10 19:19:19 +0000
commita6921ff8201f3b0c6a33e48643b77a57a135256f (patch)
tree3d870610e4f011edae425136961820117f82a522
parent40a64b567ac8a65057f1f1b9e15f0945a80ba60e (diff)
Make rw_enter() always succeed after a panic.
This prevents deadlocks when doing 'boot reboot' after the kernel panic'd. Discussed with bluhm@ and guenther@, ok visa@
-rw-r--r--sys/kern/kern_rwlock.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c
index d202a01e16d..1028c26a7da 100644
--- a/sys/kern/kern_rwlock.c
+++ b/sys/kern/kern_rwlock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_rwlock.c,v 1.28 2017/04/20 13:33:00 visa Exp $ */
+/* $OpenBSD: kern_rwlock.c,v 1.29 2017/08/10 19:19:18 mpi Exp $ */
/*
* Copyright (c) 2002, 2003 Artur Grabowski <art@openbsd.org>
@@ -236,6 +236,10 @@ retry:
unsigned long set = o | op->wait_set;
int do_sleep;
+ /* Avoid deadlocks after panic */
+ if (panicstr)
+ return (0);
+
rw_enter_diag(rwl, flags);
if (flags & RW_NOSLEEP)