Fix: add poll entry/exit around relayd_connect()
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index 8c6204c4d99352caa9ba567df11fcc97b3d2cb32..138a8b87b9f8e086ab3faff27c3892cce8fd7391 100644 (file)
@@ -485,7 +485,9 @@ static int create_connect_relayd(struct consumer_output *output,
        }
 
        /* Connect to relayd so we can proceed with a session creation. */
+       health_poll_entry();
        ret = relayd_connect(sock);
+       health_poll_exit();
        if (ret < 0) {
                ERR("Unable to reach lttng-relayd");
                ret = LTTNG_ERR_RELAYD_CONNECT_FAIL;
@@ -571,9 +573,9 @@ static int send_consumer_relayd_socket(int domain, struct ltt_session *session,
 
        /* Flag that the corresponding socket was sent. */
        if (relayd_uri->stype == LTTNG_STREAM_CONTROL) {
-               consumer->dst.net.control_sock_sent = 1;
+               consumer_sock->control_sock_sent = 1;
        } else if (relayd_uri->stype == LTTNG_STREAM_DATA) {
-               consumer->dst.net.data_sock_sent = 1;
+               consumer_sock->data_sock_sent = 1;
        }
 
        ret = LTTNG_OK;
@@ -607,7 +609,7 @@ static int send_consumer_relayd_sockets(int domain,
        assert(consumer);
 
        /* Sending control relayd socket. */
-       if (!consumer->dst.net.control_sock_sent) {
+       if (!sock->control_sock_sent) {
                ret = send_consumer_relayd_socket(domain, session,
                                &consumer->dst.net.control, consumer, sock);
                if (ret != LTTNG_OK) {
@@ -616,7 +618,7 @@ static int send_consumer_relayd_sockets(int domain,
        }
 
        /* Sending data relayd socket. */
-       if (!consumer->dst.net.data_sock_sent) {
+       if (!sock->data_sock_sent) {
                ret = send_consumer_relayd_socket(domain, session,
                                &consumer->dst.net.data, consumer, sock);
                if (ret != LTTNG_OK) {
@@ -766,6 +768,8 @@ int cmd_disable_channel(struct ltt_session *session, int domain,
 
        usess = session->ust_session;
 
+       rcu_read_lock();
+
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
        {
@@ -810,6 +814,7 @@ int cmd_disable_channel(struct ltt_session *session, int domain,
        ret = LTTNG_OK;
 
 error:
+       rcu_read_unlock();
        return ret;
 }
 
@@ -830,6 +835,8 @@ int cmd_enable_channel(struct ltt_session *session,
 
        DBG("Enabling channel %s for session %s", attr->name, session->name);
 
+       rcu_read_lock();
+
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
        {
@@ -898,6 +905,7 @@ int cmd_enable_channel(struct ltt_session *session,
        }
 
 error:
+       rcu_read_unlock();
        return ret;
 }
 
@@ -910,6 +918,8 @@ int cmd_disable_event(struct ltt_session *session, int domain,
 {
        int ret;
 
+       rcu_read_lock();
+
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
        {
@@ -968,6 +978,7 @@ int cmd_disable_event(struct ltt_session *session, int domain,
        ret = LTTNG_OK;
 
 error:
+       rcu_read_unlock();
        return ret;
 }
 
@@ -979,6 +990,8 @@ int cmd_disable_event_all(struct ltt_session *session, int domain,
 {
        int ret;
 
+       rcu_read_lock();
+
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
        {
@@ -1037,6 +1050,7 @@ int cmd_disable_event_all(struct ltt_session *session, int domain,
        ret = LTTNG_OK;
 
 error:
+       rcu_read_unlock();
        return ret;
 }
 
@@ -1126,6 +1140,8 @@ int cmd_enable_event(struct ltt_session *session, int domain,
        assert(event);
        assert(channel_name);
 
+       rcu_read_lock();
+
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
        {
@@ -1219,6 +1235,7 @@ int cmd_enable_event(struct ltt_session *session, int domain,
        ret = LTTNG_OK;
 
 error:
+       rcu_read_unlock();
        return ret;
 }
 
@@ -1235,6 +1252,8 @@ int cmd_enable_event_all(struct ltt_session *session, int domain,
        assert(session);
        assert(channel_name);
 
+       rcu_read_lock();
+
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
        {
@@ -1365,6 +1384,7 @@ int cmd_enable_event_all(struct ltt_session *session, int domain,
        ret = LTTNG_OK;
 
 error:
+       rcu_read_unlock();
        return ret;
 }
 
@@ -1644,15 +1664,8 @@ int cmd_set_consumer_uri(int domain, struct ltt_session *session,
                        goto error;
                }
 
-               /*
-                * Don't send relayd socket if URI is NOT remote or if the relayd
-                * socket for the session was already sent.
-                */
-               if (uris[i].dtype == LTTNG_DST_PATH ||
-                               (uris[i].stype == LTTNG_STREAM_CONTROL &&
-                               consumer->dst.net.control_sock_sent) ||
-                               (uris[i].stype == LTTNG_STREAM_DATA &&
-                               consumer->dst.net.data_sock_sent)) {
+               /* Don't send relayd socket if URI is NOT remote */
+               if (uris[i].dtype == LTTNG_DST_PATH) {
                        continue;
                }
 
This page took 0.026459 seconds and 4 git commands to generate.