Date: Thu, 22 Mar 2018 15:34:37 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331362 - head/sys/kern Message-ID: <201803221534.w2MFYbC8047214@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Thu Mar 22 15:34:37 2018 New Revision: 331362 URL: https://svnweb.freebsd.org/changeset/base/331362 Log: Drop any recursed taking of Giant once and for all at the top of kern_reboot(). The shutdown path is now safe to run without Giant. Discussed with: kib@ Sponsored by: Netflix Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Thu Mar 22 15:32:57 2018 (r331361) +++ head/sys/kern/kern_shutdown.c Thu Mar 22 15:34:37 2018 (r331362) @@ -366,6 +366,17 @@ kern_reboot(int howto) { static int once = 0; + /* + * Normal paths here don't hold Giant, but we can wind up here + * unexpectedly with it held. Drop it now so we don't have to + * drop and pick it up elsewhere. The paths it is locking will + * never be returned to, and it is preferable to preclude + * deadlock than to lock against code that won't ever + * continue. + */ + while (mtx_owned(&Giant)) + mtx_unlock(&Giant); + #if defined(SMP) /* * Bind us to the first CPU so that all shutdown code runs there. Some
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803221534.w2MFYbC8047214>