summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_witness.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2002-03-27 09:23:41 +0000
committerjeff <jeff@FreeBSD.org>2002-03-27 09:23:41 +0000
commitdff418f166b9e0d1e38094ab3bb7b6a6812ec6bb (patch)
tree881b84f9e9297329d00cba858d3818a9c74d2de5 /sys/kern/subr_witness.c
parent7fa55182e276dd9bbdaa9c61a231e896a5335804 (diff)
downloadFreeBSD-src-dff418f166b9e0d1e38094ab3bb7b6a6812ec6bb.zip
FreeBSD-src-dff418f166b9e0d1e38094ab3bb7b6a6812ec6bb.tar.gz
Add a new mtx_init option "MTX_DUPOK" which allows duplicate acquires of locks
with this flag. Remove the dup_list and dup_ok code from subr_witness. Now we just check for the flag instead of doing string compares. Also, switch the process lock, process group lock, and uma per cpu locks over to this interface. The original mechanism did not work well for uma because per cpu lock names are unique to each zone. Approved by: jhb
Diffstat (limited to 'sys/kern/subr_witness.c')
-rw-r--r--sys/kern/subr_witness.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index 9c0005d..53fbb96 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -124,7 +124,6 @@ static int itismychild(struct witness *parent, struct witness *child);
static void removechild(struct witness *parent, struct witness *child);
static int isitmychild(struct witness *parent, struct witness *child);
static int isitmydescendant(struct witness *parent, struct witness *child);
-static int dup_ok(struct witness *);
static int blessed(struct witness *, struct witness *);
static void witness_display_list(void(*prnt)(const char *fmt, ...),
struct witness_list *list);
@@ -228,12 +227,6 @@ static struct witness_order_list_entry order_lists[] = {
{ NULL, NULL }
};
-static const char *dup_list[] = {
- "process lock",
- "process group",
- NULL
-};
-
/*
* Pairs of locks which have been blessed
* Don't complain about order problems with blessed locks
@@ -549,7 +542,7 @@ witness_lock(struct lock_object *lock, int flags, const char *file, int line)
lock1 = &(*lock_list)->ll_children[(*lock_list)->ll_count - 1];
w1 = lock1->li_lock->lo_witness;
if (w1 == w) {
- if (w->w_same_squawked || dup_ok(w))
+ if (w->w_same_squawked || (lock->lo_flags & LO_DUPOK))
goto out;
w->w_same_squawked = 1;
printf("acquiring duplicate lock of same type: \"%s\"\n",
@@ -1144,17 +1137,6 @@ witness_displaydescendants(void(*prnt)(const char *fmt, ...),
}
static int
-dup_ok(struct witness *w)
-{
- const char **dup;
-
- for (dup = dup_list; *dup != NULL; dup++)
- if (strcmp(w->w_name, *dup) == 0)
- return (1);
- return (0);
-}
-
-static int
blessed(struct witness *w1, struct witness *w2)
{
int i;
OpenPOWER on IntegriCloud