Add session active test
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 23 Dec 2010 16:58:04 +0000 (11:58 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 23 Dec 2010 16:58:04 +0000 (11:58 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ltt-events.c
probes/lttng-events.h

index c2a6a9206304f6e5a06b4b30e55a465d0f70f589..947d772cf37bec3c1a6b1d2557e2aeb2f19dd904 100644 (file)
@@ -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);
index ee7e5d9694fdd6790c152f5ab54f3d9ea95582a2..a05c29d56771b89807ffef035b7cd6df34a0b97f 100644 (file)
@@ -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,       \
This page took 0.028719 seconds and 4 git commands to generate.