summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>1999-06-28 07:54:58 +0000
committermckusick <mckusick@FreeBSD.org>1999-06-28 07:54:58 +0000
commit0d5e2c5c4f541a3a603c249d8a1f78902eb7437c (patch)
tree587765f7b718e4c0d1942bc0b68fcb18c82368e8 /sys/kern/kern_lock.c
parent50faed161fbebfeb091461f7479a992b68e5f81f (diff)
downloadFreeBSD-src-0d5e2c5c4f541a3a603c249d8a1f78902eb7437c.zip
FreeBSD-src-0d5e2c5c4f541a3a603c249d8a1f78902eb7437c.tar.gz
When requesting an exclusive lock with LK_NOWAIT, do not panic
if LK_RECURSIVE is not set, as we will simply return that the lock is busy and not actually deadlock. This allows processes to use polling locks against buffers that they may already hold exclusively locked.
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index c7e9c84..35f6567 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -38,7 +38,7 @@
* SUCH DAMAGE.
*
* @(#)kern_lock.c 8.18 (Berkeley) 5/21/95
- * $Id: kern_lock.c,v 1.25 1999/03/15 05:11:27 julian Exp $
+ * $Id: kern_lock.c,v 1.26 1999/06/26 02:46:00 mckusick Exp $
*/
#include "opt_lint.h"
@@ -337,12 +337,14 @@ debuglockmgr(lkp, flags, interlkp, p, name, file, line)
* Recursive lock.
*/
#if !defined(MAX_PERF)
- if ((extflags & LK_CANRECURSE) == 0)
+ if ((extflags & (LK_NOWAIT | LK_CANRECURSE)) == 0)
panic("lockmgr: locking against myself");
#endif
- lkp->lk_exclusivecount++;
- COUNT(p, 1);
- break;
+ if ((extflags & LK_CANRECURSE) != 0) {
+ lkp->lk_exclusivecount++;
+ COUNT(p, 1);
+ break;
+ }
}
/*
* If we are just polling, check to see if we will sleep.
OpenPOWER on IntegriCloud