From: Mathieu Desnoyers Date: Thu, 23 Dec 2010 16:58:04 +0000 (-0500) Subject: Add session active test X-Git-Tag: v2.0-pre1~180 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=52fc2e1ff4b6e6a1050bc211ff32a6ccb977d7a4;p=lttng-modules.git Add session active test Signed-off-by: Mathieu Desnoyers --- diff --git a/ltt-events.c b/ltt-events.c index c2a6a920..947d772c 100644 --- a/ltt-events.c +++ b/ltt-events.c @@ -49,7 +49,7 @@ void ltt_session_destroy(struct ltt_session *session) int ret; mutex_lock(&sessions_mutex); - session->active = 0; + ACCESS_ONCE(session->active) = 0; list_for_each_entry(event, &session->events, list) { ret = _ltt_event_unregister(event); WARN_ON(ret); @@ -73,7 +73,7 @@ int ltt_session_start(struct ltt_session *session) ret = -EBUSY; goto end; } - session->active = 1; + ACCESS_ONCE(session->active) = 1; synchronize_trace(); /* Wait for in-flight events to complete */ end: mutex_unlock(&sessions_mutex); @@ -89,7 +89,7 @@ int ltt_session_stop(struct ltt_session *session) ret = -EBUSY; goto end; } - session->active = 0; + ACCESS_ONCE(session->active) = 0; synchronize_trace(); /* Wait for in-flight events to complete */ end: mutex_unlock(&sessions_mutex); diff --git a/probes/lttng-events.h b/probes/lttng-events.h index ee7e5d96..a05c29d5 100644 --- a/probes/lttng-events.h +++ b/probes/lttng-events.h @@ -514,6 +514,8 @@ static void __event_probe__##_name(void *__data, _proto) \ \ if (0) \ (void) __dynamic_len_idx; /* don't warn if unused */ \ + if (!ACCESS_ONCE(__chan->session->active)) \ + return; \ __event_len = __event_get_size__##_name(__dynamic_len, _args); \ __event_align = __event_get_align__##_name(_args); \ lib_ring_buffer_ctx_init(&ctx, __chan->chan, NULL, __event_len, \