svn commit: r361562 - head/sys/geom/eli

Alan Somers asomers at FreeBSD.org
Wed May 27 19:13:26 UTC 2020


Author: asomers
Date: Wed May 27 19:13:26 2020
New Revision: 361562
URL: https://svnweb.freebsd.org/changeset/base/361562

Log:
  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

Modified:
  head/sys/geom/eli/g_eli.c

Modified: head/sys/geom/eli/g_eli.c
==============================================================================
--- head/sys/geom/eli/g_eli.c	Wed May 27 18:55:24 2020	(r361561)
+++ head/sys/geom/eli/g_eli.c	Wed May 27 19:13:26 2020	(r361562)
@@ -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();


More information about the svn-src-head mailing list