Merge from OpenSolaris (15-Sep-2008):
6735480 race between probe enabling and provider registration MFC after: 1 week
This commit is contained in:
parent
c15455feb3
commit
0b8f286e83
@ -27,8 +27,6 @@
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* DTrace - Dynamic Tracing for Solaris
|
||||
*
|
||||
@ -238,6 +236,7 @@ static dtrace_ecb_t *dtrace_ecb_create_cache; /* cached created ECB */
|
||||
static dtrace_genid_t dtrace_probegen; /* current probe generation */
|
||||
static dtrace_helpers_t *dtrace_deferred_pid; /* deferred helper list */
|
||||
static dtrace_enabling_t *dtrace_retained; /* list of retained enablings */
|
||||
static dtrace_genid_t dtrace_retained_gen; /* current retained enab gen */
|
||||
static dtrace_dynvar_t dtrace_dynhash_sink; /* end of dynamic hash chains */
|
||||
#if !defined(sun)
|
||||
static struct mtx dtrace_unr_mtx;
|
||||
@ -12393,6 +12392,7 @@ dtrace_enabling_destroy(dtrace_enabling_t *enab)
|
||||
ASSERT(enab->dten_vstate->dtvs_state != NULL);
|
||||
ASSERT(enab->dten_vstate->dtvs_state->dts_nretained > 0);
|
||||
enab->dten_vstate->dtvs_state->dts_nretained--;
|
||||
dtrace_retained_gen++;
|
||||
}
|
||||
|
||||
if (enab->dten_prev == NULL) {
|
||||
@ -12435,6 +12435,7 @@ dtrace_enabling_retain(dtrace_enabling_t *enab)
|
||||
return (ENOSPC);
|
||||
|
||||
state->dts_nretained++;
|
||||
dtrace_retained_gen++;
|
||||
|
||||
if (dtrace_retained == NULL) {
|
||||
dtrace_retained = enab;
|
||||
@ -12677,6 +12678,7 @@ dtrace_enabling_provide(dtrace_provider_t *prv)
|
||||
{
|
||||
int i, all = 0;
|
||||
dtrace_probedesc_t desc;
|
||||
dtrace_genid_t gen;
|
||||
|
||||
ASSERT(MUTEX_HELD(&dtrace_lock));
|
||||
ASSERT(MUTEX_HELD(&dtrace_provider_lock));
|
||||
@ -12687,15 +12689,25 @@ dtrace_enabling_provide(dtrace_provider_t *prv)
|
||||
}
|
||||
|
||||
do {
|
||||
dtrace_enabling_t *enab = dtrace_retained;
|
||||
dtrace_enabling_t *enab;
|
||||
void *parg = prv->dtpv_arg;
|
||||
|
||||
for (; enab != NULL; enab = enab->dten_next) {
|
||||
retry:
|
||||
gen = dtrace_retained_gen;
|
||||
for (enab = dtrace_retained; enab != NULL;
|
||||
enab = enab->dten_next) {
|
||||
for (i = 0; i < enab->dten_ndesc; i++) {
|
||||
desc = enab->dten_desc[i]->dted_probe;
|
||||
mutex_exit(&dtrace_lock);
|
||||
prv->dtpv_pops.dtps_provide(parg, &desc);
|
||||
mutex_enter(&dtrace_lock);
|
||||
/*
|
||||
* Process the retained enablings again if
|
||||
* they have changed while we weren't holding
|
||||
* dtrace_lock.
|
||||
*/
|
||||
if (gen != dtrace_retained_gen)
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
} while (all && (prv = prv->dtpv_next) != NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user