g_part_taste: directly destroy consumer and geom when tasting fails

Andriy Gapon avg at FreeBSD.org
Sat Sep 22 17:07:55 UTC 2012


What do you think about the following change?
The withering also has unpleasant side effect of preventing subsequent retaste
of a provider if it quickly changes before the withering "taster" geom and
consumer are actually destroyed.

commit 660581a09ee5e7a66a272c8cf4c549170a73a012
Author: Andriy Gapon <avg at icyb.net.ua>
Date:   Wed Sep 19 20:11:32 2012 +0300

    g_part_taste: directly destroy consumer and geom here, no need for withering

diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c
index 846cd03..9e95e7e 100644
--- a/sys/geom/part/g_part.c
+++ b/sys/geom/part/g_part.c
@@ -1885,7 +1885,10 @@ g_part_taste(struct g_class *mp, struct g_provider *pp,
int flags __unused)
 	if (error == 0)
 		error = g_access(cp, 1, 0, 0);
 	if (error != 0) {
-		g_part_wither(gp, error);
+		if (cp->provider)
+			g_detach(cp);
+		g_destroy_consumer(cp);
+		g_destroy_geom(gp);
 		return (NULL);
 	}

@@ -1945,7 +1948,9 @@ g_part_taste(struct g_class *mp, struct g_provider *pp,
int flags __unused)
 	g_topology_lock();
 	root_mount_rel(rht);
 	g_access(cp, -1, 0, 0);
-	g_part_wither(gp, error);
+	g_detach(cp);
+	g_destroy_consumer(cp);
+	g_destroy_geom(gp);
 	return (NULL);
 }


-- 
Andriy Gapon


More information about the freebsd-geom mailing list