geli: fix a livelock during panic

During any kind of shutdown, kern_reboot calls geli's pre_sync event hook,
which tries to destroy all unused geli devices. But during a panic, geli
can't destroy any devices, because the scheduler is stopped, so it can't
switch threads. A livelock results, and the system never dumps core.

This commit fixes the problem by refusing to destroy any devices during
panic, used or otherwise.

PR:		246207
Reviewed by:	jhb
MFC after:	2 weeks
Sponsored by:	Axcient
Differential Revision:	https://reviews.freebsd.org/D24697
This commit is contained in:
Alan Somers 2020-05-27 19:13:26 +00:00
parent 67a26c98f2
commit 2a2306099d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=361562

View file

@ -1416,11 +1416,13 @@ g_eli_shutdown_pre_sync(void *arg, int howto)
continue;
pp = LIST_FIRST(&gp->provider);
KASSERT(pp != NULL, ("No provider? gp=%p (%s)", gp, gp->name));
if (pp->acr + pp->acw + pp->ace == 0)
error = g_eli_destroy(sc, TRUE);
else {
if (pp->acr != 0 || pp->acw != 0 || pp->ace != 0 ||
SCHEDULER_STOPPED())
{
sc->sc_flags |= G_ELI_FLAG_RW_DETACH;
gp->access = g_eli_access;
} else {
error = g_eli_destroy(sc, TRUE);
}
}
g_topology_unlock();