aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2017-08-01 23:14:38 +0000
committerMark Johnston <markj@FreeBSD.org>2017-08-01 23:14:38 +0000
commit526b5fe16c0920bf1791e932a144efb4cfbae71f (patch)
treec21677b5ae2be76cf87f04afce29916dd285c25c
parentfad5dbf8d55c6cd0647b8de52215aff65901e4f9 (diff)
downloadsrc-526b5fe16c0920bf1791e932a144efb4cfbae71f.tar.gz
src-526b5fe16c0920bf1791e932a144efb4cfbae71f.zip
Amend r321884 to check the refcount and update the class with w_mtx held.
Reviewed by: jhb X-MFC with: r321884
Notes
Notes: svn path=/head/; revision=321896
-rw-r--r--sys/kern/subr_witness.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index 8340b214b23e..be3ca31df356 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -1849,10 +1849,10 @@ enroll(const char *description, struct lock_class *lock_class)
return (w);
found:
w->w_refcount++;
- mtx_unlock_spin(&w_mtx);
if (w->w_refcount == 1)
w->w_class = lock_class;
- else if (lock_class != w->w_class)
+ mtx_unlock_spin(&w_mtx);
+ if (lock_class != w->w_class)
kassert_panic(
"lock (%s) %s does not match earlier (%s) lock",
description, lock_class->lc_name,