summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/dtrace/dtrace.c
diff options
context:
space:
mode:
authorPatrick Mooney <pmooney@pfmooney.com>2016-10-25 09:53:46 -0700
committerRobert Mustacchi <rm@joyent.com>2016-11-16 17:03:59 -0800
commit9d7cab140913ca66246ee319c3fba0feb52604a8 (patch)
tree8acd12a3dba699b3d049436aa2cfd1827cc0e4d1 /usr/src/uts/common/dtrace/dtrace.c
parent4d4abead6f393ba143c33b623554411eb7507898 (diff)
downloadillumos-joyent-9d7cab140913ca66246ee319c3fba0feb52604a8.tar.gz
7505 dtrace helpers leaked during fork when lwp_create fails
Reviewed by: Bryan Cantrill <bryan@joyent.com> Reviewed by: Ryan Zezeski <rpz@joyent.com> Reviewed by: Adam Leventhal <adam.leventhal@gmail.com> Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com> Reviewed by: Alek Pinchuk <pinchuk.alek@gmail.com> Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/uts/common/dtrace/dtrace.c')
-rw-r--r--usr/src/uts/common/dtrace/dtrace.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/usr/src/uts/common/dtrace/dtrace.c b/usr/src/uts/common/dtrace/dtrace.c
index 3aeeef27f7..28ad7ec09b 100644
--- a/usr/src/uts/common/dtrace/dtrace.c
+++ b/usr/src/uts/common/dtrace/dtrace.c
@@ -15440,11 +15440,10 @@ dtrace_helpers_create(proc_t *p)
}
static void
-dtrace_helpers_destroy(void)
+dtrace_helpers_destroy(proc_t *p)
{
dtrace_helpers_t *help;
dtrace_vstate_t *vstate;
- proc_t *p = curproc;
int i;
mutex_enter(&dtrace_lock);
@@ -15459,10 +15458,21 @@ dtrace_helpers_destroy(void)
* We're now going to lose the help from this process.
*/
p->p_dtrace_helpers = NULL;
- dtrace_sync();
+ if (p == curproc) {
+ dtrace_sync();
+ } else {
+ /*
+ * It is sometimes necessary to clean up dtrace helpers from a
+ * an incomplete child process as part of a failed fork
+ * operation. In such situations, a dtrace_sync() call should
+ * be unnecessary as the process should be devoid of threads,
+ * much less any in probe context.
+ */
+ VERIFY(p->p_stat == SIDL);
+ }
/*
- * Destory the helper actions.
+ * Destroy the helper actions.
*/
for (i = 0; i < DTRACE_NHELPER_ACTIONS; i++) {
dtrace_helper_action_t *h, *next;