Amend r321884 to check the refcount and update the class with w_mtx held.
Reviewed by: jhb X-MFC with: r321884
This commit is contained in:
parent
fad5dbf8d5
commit
526b5fe16c
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user