git: 342053a66c16 - stable/14 - sched_unpin(): assert that curthread was pinned

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 03 Jul 2024 08:02:56 UTC
The branch stable/14 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=342053a66c161c12f6887efac913c80040959ae8

commit 342053a66c161c12f6887efac913c80040959ae8
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-06-25 20:08:22 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-07-03 08:02:28 +0000

    sched_unpin(): assert that curthread was pinned
    
    (cherry picked from commit 7e5574f9e5d9df749ffc49657717527cfa93f6b4)
---
 sys/sys/sched.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index 9d37e8f0f999..933f05385675 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -180,6 +180,7 @@ static __inline void
 sched_unpin(void)
 {
 	atomic_interrupt_fence();
+	MPASS(curthread->td_pinned > 0);
 	curthread->td_pinned--;
 }