git: 8da1c3715139 - stable/14 - reboot: Avoid unlocking Giant if the scheduler is stopped
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 07 Nov 2023 00:23:50 UTC
The branch stable/14 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=8da1c3715139ecfbda9159c766507e0f80212e92
commit 8da1c3715139ecfbda9159c766507e0f80212e92
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-11-04 14:48:58 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-11-07 00:23:38 +0000
reboot: Avoid unlocking Giant if the scheduler is stopped
When the scheduler is stopped, mtx_unlock() turns into a no-op, so the
loop
while (mtx_owned(&Giant))
mtx_unlock(&Giant);
runs forever if the calling thread has Giant locked.
Reviewed by: mhorne
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42460
(cherry picked from commit deacab756026f86515781944a9e0271e8db9f86b)
---
sys/kern/kern_shutdown.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index e0eff6dbec01..19920d30357f 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -471,7 +471,7 @@ kern_reboot(int howto)
* deadlock than to lock against code that won't ever
* continue.
*/
- while (mtx_owned(&Giant))
+ while (!SCHEDULER_STOPPED() && mtx_owned(&Giant))
mtx_unlock(&Giant);
#if defined(SMP)