A successful call from ust_app_register makes the application visible to
the tracing registry on the client side so by moving this lock at the
start of the registration process until the end, we are certain that the
application does not receive an out of order message during
registration.
It basically protects the application registration from tracing command
such as enable-event.
This has been fixed in the master branch by an other commit during the
2.2 development phase.
Signed-off-by: David Goulet <dgoulet@efficios.com>
{
struct ltt_session *sess, *stmp;
{
struct ltt_session *sess, *stmp;
/* For all tracing session(s) */
cds_list_for_each_entry_safe(sess, stmp, &session_list_ptr->head, list) {
session_lock(sess);
/* For all tracing session(s) */
cds_list_for_each_entry_safe(sess, stmp, &session_list_ptr->head, list) {
session_lock(sess);
}
session_unlock(sess);
}
}
session_unlock(sess);
}
-
- session_unlock_list();
+ /*
+ * @session_lock
+ * Lock the global session list so from the register up to
+ * the registration done message, no thread can see the
+ * application and change its state.
+ */
+ session_lock_list();
+
/* Register applicaton to the session daemon */
ret = ust_app_register(&ust_cmd.reg_msg,
ust_cmd.sock);
if (ret == -ENOMEM) {
/* Register applicaton to the session daemon */
ret = ust_app_register(&ust_cmd.reg_msg,
ust_cmd.sock);
if (ret == -ENOMEM) {
goto error;
} else if (ret < 0) {
goto error;
} else if (ret < 0) {
ret = lttng_poll_add(&events, ust_cmd.sock,
LPOLLERR & LPOLLHUP & LPOLLRDHUP);
if (ret < 0) {
ret = lttng_poll_add(&events, ust_cmd.sock,
LPOLLERR & LPOLLHUP & LPOLLRDHUP);
if (ret < 0) {
DBG("Apps with sock %d added to poll set",
ust_cmd.sock);
}
DBG("Apps with sock %d added to poll set",
ust_cmd.sock);
}