From: Francis Deslauriers Date: Thu, 10 Jul 2014 22:22:14 +0000 (-0400) Subject: Move enablers syncing after the channel registration X-Git-Tag: v2.5.0~5 X-Git-Url: http://git.liburcu.org/?p=lttng-ust.git;a=commitdiff_plain;h=5c0552753c1d70bbf7cf9808b427c941ac58a256 Move enablers syncing after the channel registration Fixes possible race condition where an event registration is received before its channel registration by the consumer. Signed-off-by: Francis Deslauriers Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/lttng-events.c b/liblttng-ust/lttng-events.c index e44628df..285b98e8 100644 --- a/liblttng-ust/lttng-events.c +++ b/liblttng-ust/lttng-events.c @@ -248,8 +248,6 @@ int lttng_session_enable(struct lttng_session *session) /* Set transient enabler state to "enabled" */ session->tstate = 1; - /* We need to sync enablers with session before activation. */ - lttng_session_sync_enablers(session); /* * Snapshot the number of events per channel to know the type of header @@ -287,6 +285,9 @@ int lttng_session_enable(struct lttng_session *session) } } + /* We need to sync enablers with session before activation. */ + lttng_session_sync_enablers(session); + /* Set atomically the state to "active" */ CMM_ACCESS_ONCE(session->active) = 1; CMM_ACCESS_ONCE(session->been_active) = 1;