From 69097daeb633dafd0e439e1d3ca0e099e56898fe Mon Sep 17 00:00:00 2001 From: mav Date: Fri, 5 Apr 2013 10:35:36 +0000 Subject: [PATCH] MFC r238198 (by trasz): Fix orphan() methods of several GEOM classes to not assume that there is an error set on the provider. With GEOM resizing, class can become orphaned when it doesn't implement resize() method and the provider size decreases. git-svn-id: svn://svn.freebsd.org/base/stable/9@249148 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/geom/bde/g_bde.c | 6 +----- sys/geom/geom_aes.c | 4 +--- sys/geom/geom_slice.c | 4 +--- sys/geom/uncompress/g_uncompress.c | 4 +--- sys/geom/uzip/g_uzip.c | 4 +--- 5 files changed, 5 insertions(+), 17 deletions(-) diff --git a/sys/geom/bde/g_bde.c b/sys/geom/bde/g_bde.c index 7d879f0be..6e299a702 100644 --- a/sys/geom/bde/g_bde.c +++ b/sys/geom/bde/g_bde.c @@ -77,19 +77,15 @@ g_bde_orphan(struct g_consumer *cp) struct g_geom *gp; struct g_provider *pp; struct g_bde_softc *sc; - int error; g_trace(G_T_TOPOLOGY, "g_bde_orphan(%p/%s)", cp, cp->provider->name); g_topology_assert(); - KASSERT(cp->provider->error != 0, - ("g_bde_orphan with error == 0")); gp = cp->geom; sc = gp->softc; gp->flags |= G_GEOM_WITHER; - error = cp->provider->error; LIST_FOREACH(pp, &gp->provider, provider) - g_orphan_provider(pp, error); + g_orphan_provider(pp, ENXIO); bzero(sc, sizeof(struct g_bde_softc)); /* destroy evidence */ return; } diff --git a/sys/geom/geom_aes.c b/sys/geom/geom_aes.c index 6270dcf4b..c9f079097 100644 --- a/sys/geom/geom_aes.c +++ b/sys/geom/geom_aes.c @@ -241,12 +241,10 @@ g_aes_orphan(struct g_consumer *cp) g_trace(G_T_TOPOLOGY, "g_aes_orphan(%p/%s)", cp, cp->provider->name); g_topology_assert(); - KASSERT(cp->provider->error != 0, - ("g_aes_orphan with error == 0")); gp = cp->geom; sc = gp->softc; - g_wither_geom(gp, cp->provider->error); + g_wither_geom(gp, ENXIO); bzero(sc, sizeof(struct g_aes_softc)); /* destroy evidence */ g_free(sc); return; diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index 4d03642c1..b1ebdbede 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -522,10 +522,8 @@ g_slice_orphan(struct g_consumer *cp) g_trace(G_T_TOPOLOGY, "g_slice_orphan(%p/%s)", cp, cp->provider->name); g_topology_assert(); - KASSERT(cp->provider->error != 0, - ("g_slice_orphan with error == 0")); /* XXX: Not good enough we leak the softc and its suballocations */ g_slice_free(cp->geom->softc); - g_wither_geom(cp->geom, cp->provider->error); + g_wither_geom(cp->geom, ENXIO); } diff --git a/sys/geom/uncompress/g_uncompress.c b/sys/geom/uncompress/g_uncompress.c index 778d5c6f4..f8227029e 100644 --- a/sys/geom/uncompress/g_uncompress.c +++ b/sys/geom/uncompress/g_uncompress.c @@ -406,13 +406,11 @@ g_uncompress_orphan(struct g_consumer *cp) g_trace(G_T_TOPOLOGY, "%s(%p/%s)", __func__, cp, cp->provider->name); g_topology_assert(); - KASSERT(cp->provider->error != 0, - ("g_uncompress_orphan with error == 0")); gp = cp->geom; g_uncompress_softc_free(gp->softc, gp); gp->softc = NULL; - g_wither_geom(gp, cp->provider->error); + g_wither_geom(gp, ENXIO); } static int diff --git a/sys/geom/uzip/g_uzip.c b/sys/geom/uzip/g_uzip.c index f19e14c60..03272115e 100644 --- a/sys/geom/uzip/g_uzip.c +++ b/sys/geom/uzip/g_uzip.c @@ -313,13 +313,11 @@ g_uzip_orphan(struct g_consumer *cp) g_trace(G_T_TOPOLOGY, "g_uzip_orphan(%p/%s)", cp, cp->provider->name); g_topology_assert(); - KASSERT(cp->provider->error != 0, - ("g_uzip_orphan with error == 0")); gp = cp->geom; g_uzip_softc_free(gp->softc, gp); gp->softc = NULL; - g_wither_geom(gp, cp->provider->error); + g_wither_geom(gp, ENXIO); } static int -- 2.45.0