aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2026-02-22 19:26:17 +0000
committerMark Johnston <markj@FreeBSD.org>2026-02-22 19:26:17 +0000
commiteaeb356ce3491f05b6a99ccd485180a42df22c46 (patch)
treec8bcb844466abfc69d62da547bcb854a38579215
parentacbf7498f5e11b00ffcd6c12bdb8bd1eddeb6d7f (diff)
buf: Relax an assertion in BUF_UNLOCK
The BUF_UNLOCK macro asserts that B_REMFREE is not set, as it is up to the lock owner to complete the dequeue from the free list before releasing the lock. However, if the thread has acquired the lock multiple times, then releasing the recursive lock should be ok. Modify the assertion to reflect this. This was triggered by an out-of-tree filesystem. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55418
-rw-r--r--sys/sys/buf.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/sys/buf.h b/sys/sys/buf.h
index f08f05e6d50f..85ff5f3dfdc1 100644
--- a/sys/sys/buf.h
+++ b/sys/sys/buf.h
@@ -321,7 +321,7 @@ struct buf {
* it has been handed off to biodone.
*/
#define BUF_UNLOCK(bp) do { \
- KASSERT(((bp)->b_flags & B_REMFREE) == 0, \
+ KASSERT(((bp)->b_flags & B_REMFREE) == 0 || BUF_LOCKRECURSED(bp), \
("BUF_UNLOCK %p while B_REMFREE is still set.", (bp))); \
\
BUF_UNLOCK_RAW((bp)); \