diff options
author | markj <markj@FreeBSD.org> | 2013-10-08 12:56:46 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2013-10-08 12:56:46 +0000 |
commit | 4e3872abc7d06e32c81c7d991a15245489dfa749 (patch) | |
tree | 0ac019beee24414f3072bb5d72839a91ed0b4571 /sys/cddl/dev/dtrace | |
parent | 66c01d36f385e2199625a2464868668ab1a69ba8 (diff) | |
download | FreeBSD-src-4e3872abc7d06e32c81c7d991a15245489dfa749.zip FreeBSD-src-4e3872abc7d06e32c81c7d991a15245489dfa749.tar.gz |
Initialize and free the DTrace taskqueue in the dtrace module load/unload
handlers rather than in the dtrace device open/close methods. The current
approach can cause a panic if the device is closed which the taskqueue
thread is active, or if a kernel module containing a provider is unloaded
while retained enablings are present and the dtrace device isn't opened.
Submitted by: gibbs (original version)
Reviewed by: gibbs
Approved by: re (glebius)
MFC after: 2 weeks
Diffstat (limited to 'sys/cddl/dev/dtrace')
-rw-r--r-- | sys/cddl/dev/dtrace/dtrace_load.c | 2 | ||||
-rw-r--r-- | sys/cddl/dev/dtrace/dtrace_unload.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/sys/cddl/dev/dtrace/dtrace_load.c b/sys/cddl/dev/dtrace/dtrace_load.c index 05436fe..5d59a04 100644 --- a/sys/cddl/dev/dtrace/dtrace_load.c +++ b/sys/cddl/dev/dtrace/dtrace_load.c @@ -56,6 +56,8 @@ dtrace_load(void *dummy) /* Hang our hook for exceptions. */ dtrace_invop_init(); + dtrace_taskq = taskq_create("dtrace_taskq", 1, maxclsyspri, 0, 0, 0); + /* Register callbacks for linker file load and unload events. */ dtrace_kld_load_tag = EVENTHANDLER_REGISTER(kld_load, dtrace_kld_load, NULL, EVENTHANDLER_PRI_ANY); diff --git a/sys/cddl/dev/dtrace/dtrace_unload.c b/sys/cddl/dev/dtrace/dtrace_unload.c index e9bd53c..41b7538 100644 --- a/sys/cddl/dev/dtrace/dtrace_unload.c +++ b/sys/cddl/dev/dtrace/dtrace_unload.c @@ -127,6 +127,8 @@ dtrace_unload() mutex_destroy(&dtrace_errlock); #endif + taskq_destroy(dtrace_taskq); + /* Reset our hook for exceptions. */ dtrace_invop_uninit(); |