git: deacab756026 - main - reboot: Avoid unlocking Giant if the scheduler is stopped
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 04 Nov 2023 14:49:37 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=deacab756026f86515781944a9e0271e8db9f86b commit deacab756026f86515781944a9e0271e8db9f86b Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2023-11-04 14:48:58 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2023-11-04 14:48:58 +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 --- 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)