git: c589d6a09f5e - stable/15 - buf: Relax an assertion in BUF_UNLOCK
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 31 Mar 2026 15:59:00 UTC
The branch stable/15 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=c589d6a09f5ec9096784d14a4a0fb136ea3de208
commit c589d6a09f5ec9096784d14a4a0fb136ea3de208
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-02-22 19:26:17 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-03-31 15:57:29 +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
(cherry picked from commit eaeb356ce3491f05b6a99ccd485180a42df22c46)
---
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)); \