svn commit: r362118 - stable/12/sys/geom/eli

Alan Somers asomers at FreeBSD.org
Fri Jun 12 20:39:43 UTC 2020


Author: asomers
Date: Fri Jun 12 20:39:42 2020
New Revision: 362118
URL: https://svnweb.freebsd.org/changeset/base/362118

Log:
  MFC r361562:
  
  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
  Sponsored by:	Axcient
  Differential Revision:	https://reviews.freebsd.org/D24697

Modified:
  stable/12/sys/geom/eli/g_eli.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/geom/eli/g_eli.c
==============================================================================
--- stable/12/sys/geom/eli/g_eli.c	Fri Jun 12 20:33:00 2020	(r362117)
+++ stable/12/sys/geom/eli/g_eli.c	Fri Jun 12 20:39:42 2020	(r362118)
@@ -1320,11 +1320,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-all mailing list