git: eaeb356ce349 - main - buf: Relax an assertion in BUF_UNLOCK
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 22 Feb 2026 19:27:06 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=eaeb356ce3491f05b6a99ccd485180a42df22c46
commit eaeb356ce3491f05b6a99ccd485180a42df22c46
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-02-22 19:26:17 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-02-22 19:26:17 +0000
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
---
sys/sys/buf.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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)); \