Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 08 Jul 2004 19:15:43 +0200
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        Pawel Jakub Dawidek <pjd@freebsd.org>
Cc:        geom@freebsd.org
Subject:   Re: Current GEOM problems. 
Message-ID:  <3838.1089306943@critter.freebsd.dk>
In-Reply-To: Your message of "Wed, 07 Jul 2004 03:29:04 %2B0200." <20040707012904.GP12007@darkness.comp.waw.pl> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20040707012904.GP12007@darkness.comp.waw.pl>, Pawel Jakub Dawidek w
rites:

>2. Every class which use geom_slice cannot be unload when it has geoms
>   (actually providers), because g_slice_destroy_geom() calls
>   g_slice_spoiled() and g_slice_spoiled() calls g_wither_geom().
>   If there are providers, geom will not be imediately destroyed,
>   but orphan event will be send, so next time when g_slice_destroy_geom()
>   will be called for the same geom it will panic, because gp->softc is
>   NULL.


can you try this untested patch ?

Index: geom_slice.c
===================================================================
RCS file: /home/ncvs/src/sys/geom/geom_slice.c,v
retrieving revision 1.54
diff -u -r1.54 geom_slice.c
--- geom_slice.c	4 Jul 2004 13:44:48 -0000	1.54
+++ geom_slice.c	8 Jul 2004 17:15:12 -0000
@@ -439,8 +439,13 @@
 int
 g_slice_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp)
 {
+	struct g_slicer *gsp;
 
-	g_slice_spoiled(LIST_FIRST(&gp->consumer));
+	g_topology_assert();
+	gsp = gp->softc;
+	gp->softc = NULL;
+	g_slice_free(gsp);
+	g_wither_geom(gp, ENXIO);
 	return (0);
 }
 

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3838.1089306943>