Only allow for unloading when there are no geoms in LABEL GEOM class. We have to use our own destroy_geom method, because default one, which is a part of geom_slice is broken. Index: g_label.c =================================================================== RCS file: /private/FreeBSD/src/sys/geom/label/g_label.c,v retrieving revision 1.7.2.2 diff -u -p -r1.7.2.2 g_label.c --- g_label.c 28 Sep 2004 18:19:30 -0000 1.7.2.2 +++ g_label.c 14 Oct 2004 19:37:11 -0000 @@ -48,6 +48,8 @@ TUNABLE_INT("kern.geom.label.debug", &g_ SYSCTL_UINT(_kern_geom_label, OID_AUTO, debug, CTLFLAG_RW, &g_label_debug, 0, "Debug level"); +static int g_label_destroy_geom(struct gctl_req *req, struct g_class *mp, + struct g_geom *gp); static int g_label_destroy(struct g_geom *gp, boolean_t force); static struct g_geom *g_label_taste(struct g_class *mp, struct g_provider *pp, int flags __unused); @@ -58,7 +60,8 @@ struct g_class g_label_class = { .name = G_LABEL_CLASS_NAME, .version = G_VERSION, .ctlreq = g_label_config, - .taste = g_label_taste + .taste = g_label_taste, + .destroy_geom = g_label_destroy_geom }; /* @@ -76,6 +79,18 @@ const struct g_label_desc *g_labels[] = }; +static int +g_label_destroy_geom(struct gctl_req *req __unused, struct g_class *mp, + struct g_geom *gp __unused) +{ + + /* + * XXX: Unloading a class which is using geom_slice:1.56 is currently + * XXX: broken, so we deny unloading when we have geoms. + */ + return (EOPNOTSUPP); +} + static void g_label_orphan(struct g_consumer *cp __unused) {