Move the NORELEASE check to after the recurse count decrement and bailout, this

is not counted as actually releasing the lock.
This commit is contained in:
Andrew Thompson 2009-02-28 19:10:43 +00:00
parent f35aaff035
commit fef11cb704
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=189194

View File

@ -1511,12 +1511,6 @@ witness_unlock(struct lock_object *lock, int flags, const char *file, int line)
instance->li_line);
panic("share->uexcl");
}
if ((instance->li_flags & LI_NORELEASE) != 0 && witness_watch > 0) {
printf("forbidden unlock of (%s) %s @ %s:%d\n", class->lc_name,
lock->lo_name, file, line);
panic("lock marked norelease");
}
/* If we are recursed, unrecurse. */
if ((instance->li_flags & LI_RECURSEMASK) > 0) {
CTR4(KTR_WITNESS, "%s: pid %d unrecursed on %s r=%d", __func__,
@ -1525,6 +1519,12 @@ witness_unlock(struct lock_object *lock, int flags, const char *file, int line)
instance->li_flags--;
return;
}
/* The lock is now being dropped, check for NORELEASE flag */
if ((instance->li_flags & LI_NORELEASE) != 0 && witness_watch > 0) {
printf("forbidden unlock of (%s) %s @ %s:%d\n", class->lc_name,
lock->lo_name, file, line);
panic("lock marked norelease");
}
/* Otherwise, remove this item from the list. */
s = intr_disable();