From 0ed4f6a1800cd4b5f1157b1e4e5d31175b0eb440 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 2 Feb 2004 19:49:41 +0000 Subject: [PATCH] Allow a GEOM class to unload if it has no geoms or a method function to get rid of them. Prodded by: pjd --- sys/geom/geom_subr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index 0d6d24c2784a..a56c0af0b0f9 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -126,7 +126,12 @@ g_unload_class(void *arg, int flag) hh = arg; mp = hh->mp; g_trace(G_T_TOPOLOGY, "g_unload_class(%s)", mp->name); - if (mp->destroy_geom == NULL) { + + /* + * We allow unloading if we have no geoms, or a class + * method we can use to get rid of them. + */ + if (!LIST_EMPTY(&mp->geom) && mp->destroy_geom == NULL) { hh->error = EOPNOTSUPP; return; }