Require kldunload -f to unload.

Code may still be executing from the wrappers at unload time and thus is
not generally safe to unload.  Converting the wrappers to use
EVENTHANDLER(9) will allow this to safely drain on active threads in
hooks.  More work on EVENTHANDLER(9) is needed first.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Bryan Drewery 2016-03-07 21:39:29 +00:00
parent 4f8a1fd8cd
commit 4039c53163
2 changed files with 10 additions and 2 deletions

View File

@ -194,3 +194,6 @@ Only children of the set process are logged.
Processes can escape being traced by double forking.
This is not seen as a problem as the intended use is build monitoring, which
does not make sense to have daemons for.
.Pp
Unloading the module may panic the system, thus requires using
.Ic kldunload -f .

View File

@ -68,8 +68,6 @@ extern struct sysentvec elf64_freebsd_sysvec;
static d_close_t filemon_close;
static d_ioctl_t filemon_ioctl;
static d_open_t filemon_open;
static int filemon_unload(void);
static void filemon_load(void *);
static struct cdevsw filemon_cdevsw = {
.d_version = D_VERSION,
@ -301,6 +299,13 @@ filemon_modevent(module_t mod __unused, int type, void *data)
error = filemon_unload();
break;
case MOD_QUIESCE:
/*
* The wrapper implementation is unsafe for reliable unload.
* Require forcing an unload.
*/
error = EBUSY;
case MOD_SHUTDOWN:
break;