Date: Sat, 4 Nov 2023 14:49:37 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: deacab756026 - main - reboot: Avoid unlocking Giant if the scheduler is stopped Message-ID: <202311041449.3A4Enbk6053408@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202311041449.3A4Enbk6053408>