Problem with g_unload_class()

Pawel Jakub Dawidek pjd at FreeBSD.org
Fri Mar 26 03:00:50 PST 2004


On Fri, Mar 26, 2004 at 11:55:14AM +0100, Poul-Henning Kamp wrote:
+> Hi, this just to say that I have not forgot you.
+> 
+> The underlying problem is how we want unloading to work.  There are two
+> sensible an one bad way it could work:
+> 
+> sensible 1:
+> 	"I tried to unload, but couldn't, nothing has changed".
+> 
+> sensible 2:
+> 	"I forcefully unloaded, you probably lost some data"
+> 
+> silly:
+> 	"I couldn't unload and couldn't.  A lot of stuff got modified
+> 	and the module is now only half functional.
+> 
+> I'd prefer we have it be the first two (controlled by an option) but
+> currently we're sort of stuck in the bottom one.

My idea is to use LIST_FOREACH_SAFE() macro, like I did in my old patch:

	http://people.freebsd.org/~pjd/patches/geom_subr.c.11.patch

And maybe we should add:

	if (!LIST_EMPTY(&mp->geom))
		error = EBUSY;

after this loop.
With this change we don't leave objects from class that was unloaded
and we'll not end up with an infinite loop.

-- 
Pawel Jakub Dawidek                       http://www.FreeBSD.org
pjd at FreeBSD.org                           http://garage.freebsd.pl
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-geom/attachments/20040326/8994cef1/attachment.bin


More information about the freebsd-geom mailing list