From owner-freebsd-hackers Wed Apr 30 02:10:38 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id CAA17323 for hackers-outgoing; Wed, 30 Apr 1997 02:10:38 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id CAA17314 for ; Wed, 30 Apr 1997 02:10:33 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.5/8.6.9) id TAA13932; Wed, 30 Apr 1997 19:05:12 +1000 Date: Wed, 30 Apr 1997 19:05:12 +1000 From: Bruce Evans Message-Id: <199704300905.TAA13932@godzilla.zeta.org.au> To: avalon@coombs.anu.edu.au, bde@zeta.org.au Subject: Re: Unloading LKMs (was Re: A Desparate Plea for Help...) Cc: hackers@FreeBSD.org, msmith@atrad.adelaide.edu.au Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk >> >> > Er, AFAIK unloading LKM drivers is broken in all cases. It certainly >> ^^^^^^^ >> >> >Hmmm, IP Filter unloads and reloads easily enough. >> >> It's not a driver. > >Actually, it is a character device module: >MOD_DECL(if_ipl); > >static struct lkm_dev _module = { > LM_DEV, > LKM_VERSION, > IPL_VERSION, > CDEV_MAJOR, > LM_DT_CHAR, > (void *)&ipl_cdevsw >}; Oops. It's probably broken then. I think there is no problem in 2.1.x. I think the problem is caused by incomplete conversion to indirect devsw's. >> Drivers are supposed to do nothing return nonzero in their unload function >> if they are busy. > >I found that attempting to keep track of whether you are busy or not made >things worse. Whether it be via signal 9 or whatever, it is somehow possible >for things to not get cleaned up properly and you end up thinking you are >busy when you aren't. Maybe this has changed or someone wants to look >into it further ? At least for pure device drivers, just keep track of opens and don't allow unloading if anything is open. Bruce