Fix: sessiond: bad fd used while rotating exiting app's buffers
[lttng-tools.git] / src / bin / lttng-sessiond / dispatch.c
index d33a3cba8fac0d231aabd527400b83adc7645d6f..c4ce36e7e96b6d6d1cccb9c7f8dc076a597ab995 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
+ * Copyright (C) 2011 EfficiOS Inc.
  * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  * Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
@@ -39,7 +39,7 @@ static void update_ust_app(int app_sock)
        struct ust_app *app;
 
        /* Consumer is in an ERROR state. Stop any application update. */
-       if (uatomic_read(&ust_consumerd_state) == CONSUMER_ERROR) {
+       if (uatomic_read(&the_ust_consumerd_state) == CONSUMER_ERROR) {
                /* Stop the update process since the consumer is dead. */
                return;
        }
@@ -67,7 +67,8 @@ static void update_ust_app(int app_sock)
                        continue;
                }
                session_lock(sess);
-               if (!sess->active || !sess->ust_session) {
+               if (!sess->active || !sess->ust_session ||
+                               !sess->ust_session->active) {
                        goto unlock_session;
                }
 
@@ -144,7 +145,7 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue)
                                        (revents & (LPOLLHUP | LPOLLERR))) {
                                cds_list_del(&wait_node->head);
                                wait_queue->count--;
-                               ust_app_destroy(wait_node->app);
+                               ust_app_put(wait_node->app);
                                free(wait_node);
                                /*
                                 * Silence warning of use-after-free in
@@ -235,7 +236,8 @@ static void *thread_dispatch_ust_registration(void *data)
 
        rcu_register_thread();
 
-       health_register(health_sessiond, HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH);
+       health_register(the_health_sessiond,
+                       HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH);
 
        if (testpoint(sessiond_thread_app_reg_dispatch)) {
                goto error_testpoint;
@@ -288,7 +290,7 @@ static void *thread_dispatch_ust_registration(void *data)
                                        ust_cmd->sock, ust_cmd->reg_msg.name,
                                        ust_cmd->reg_msg.major, ust_cmd->reg_msg.minor);
 
-                       if (ust_cmd->reg_msg.type == USTCTL_SOCKET_CMD) {
+                       if (ust_cmd->reg_msg.type == LTTNG_UST_CTL_SOCKET_CMD) {
                                wait_node = zmalloc(sizeof(*wait_node));
                                if (!wait_node) {
                                        PERROR("zmalloc wait_node dispatch");
@@ -486,7 +488,7 @@ error_testpoint:
                health_error();
                ERR("Health error occurred in %s", __func__);
        }
-       health_unregister(health_sessiond);
+       health_unregister(the_health_sessiond);
        rcu_unregister_thread();
        return NULL;
 }
This page took 0.025686 seconds and 4 git commands to generate.