svn commit: r356182 - head/sys/geom/shsec

Alexander Motin mav at FreeBSD.org
Sun Dec 29 19:33:42 UTC 2019


Author: mav
Date: Sun Dec 29 19:33:41 2019
New Revision: 356182
URL: https://svnweb.freebsd.org/changeset/base/356182

Log:
  Missed part of r356162.
  
  If we postpone consumer destruction till close, then the close calls should
  not be ignored.  Delay geom withering till the last close too.
  
  MFC after:	2 weeks
  X-MFC-with:	r356162
  Sponsored by:	iXsystems, Inc.

Modified:
  head/sys/geom/shsec/g_shsec.c

Modified: head/sys/geom/shsec/g_shsec.c
==============================================================================
--- head/sys/geom/shsec/g_shsec.c	Sun Dec 29 19:21:29 2019	(r356181)
+++ head/sys/geom/shsec/g_shsec.c	Sun Dec 29 19:33:41 2019	(r356182)
@@ -184,7 +184,7 @@ g_shsec_orphan(struct g_consumer *cp)
 
 	g_shsec_remove_disk(cp);
 	/* If there are no valid disks anymore, remove device. */
-	if (g_shsec_nvalid(sc) == 0)
+	if (LIST_EMPTY(&gp->consumer))
 		g_shsec_destroy(sc, 1);
 }
 
@@ -199,21 +199,6 @@ g_shsec_access(struct g_provider *pp, int dr, int dw, 
 	gp = pp->geom;
 	sc = gp->softc;
 
-	if (sc == NULL) {
-		/*
-		 * It looks like geom is being withered.
-		 * In that case we allow only negative requests.
-		 */
-		KASSERT(dr <= 0 && dw <= 0 && de <= 0,
-		    ("Positive access request (device=%s).", pp->name));
-		if ((pp->acr + dr) == 0 && (pp->acw + dw) == 0 &&
-		    (pp->ace + de) == 0) {
-			G_SHSEC_DEBUG(0, "Device %s definitely destroyed.",
-			    gp->name);
-		}
-		return (0);
-	}
-
 	/* On first open, grab an extra "exclusive" bit */
 	if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0)
 		de++;
@@ -232,6 +217,11 @@ g_shsec_access(struct g_provider *pp, int dr, int dw, 
 			g_destroy_consumer(cp1);
 		}
 	}
+
+	/* If there are no valid disks anymore, remove device. */
+	if (LIST_EMPTY(&gp->consumer))
+		g_shsec_destroy(sc, 1);
+
 	return (error);
 
 fail:


More information about the svn-src-all mailing list