Date: Mon, 26 May 2003 20:22:09 +0100 From: "Duncan Barclay" <dmlb@dmlb.org> To: <current@freebsd.org>, <freebsd-current@freebsd.org> Subject: kldunload and device detach panics Message-ID: <001d01c323bc$1a474cd0$4bc8a8c0@orac>
next in thread | raw e-mail | index | archive | help
Hi Whilst starting work on porting the Linux Broadcom 440x 10/100 driver I've come across a bit of a problem with kldunload and its interaction with device xxx_detach. I'm cribbing code from if_bge.c and if_rl.c (picked at random). if_rl.c uses a mutex for locking the softc. If the rl_detach routine is called twice (for example failing attach and then kldunload) the mutex gets destroyed twice - leading to a panic with witness. Is there a safe sequence of mutex checking etc. to avoid killing the machine in this way? At present I'm assuming that if the mutex is not initialised then _detach doesn't need to clean as nothing could have been set up, or it has already been cleaned. Duncan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001d01c323bc$1a474cd0$4bc8a8c0>