svn commit: r296472 - in head: share/man/man4 sys/dev/filemon

Bryan Drewery bdrewery at FreeBSD.org
Mon Mar 7 21:39:31 UTC 2016


Author: bdrewery
Date: Mon Mar  7 21:39:29 2016
New Revision: 296472
URL: https://svnweb.freebsd.org/changeset/base/296472

Log:
  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

Modified:
  head/share/man/man4/filemon.4
  head/sys/dev/filemon/filemon.c

Modified: head/share/man/man4/filemon.4
==============================================================================
--- head/share/man/man4/filemon.4	Mon Mar  7 21:11:35 2016	(r296471)
+++ head/share/man/man4/filemon.4	Mon Mar  7 21:39:29 2016	(r296472)
@@ -194,3 +194,6 @@ Only children of the set process are log
 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 .

Modified: head/sys/dev/filemon/filemon.c
==============================================================================
--- head/sys/dev/filemon/filemon.c	Mon Mar  7 21:11:35 2016	(r296471)
+++ head/sys/dev/filemon/filemon.c	Mon Mar  7 21:39:29 2016	(r296472)
@@ -68,8 +68,6 @@ extern struct sysentvec elf64_freebsd_sy
 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, 
 		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;
 


More information about the svn-src-head mailing list