From fd5a50b08e891ff4bbcf7f2cd0fbd1d289e19101 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Mon, 18 Feb 2013 14:08:19 -0500 Subject: [PATCH] Fix: set relayd sock sent flag per consumer socket The session daemon usually handles two consumers, one for 32 bits applications and one for 64 bits. When sending relayd information to the consumer, we must sent it to every existing consumer in case a session contains 32 and 64 bits applications. So, the sent flag is moved from the consumer output object to be per consumer socket. This bug was seen and diagnosed during the 2.2 development phase and is fixed in master branch in the following commit. commit (master): ffe600149a7608221985751e1bf293234bf2545c Signed-off-by: David Goulet --- src/bin/lttng-sessiond/cmd.c | 19 ++++++------------- src/bin/lttng-sessiond/consumer.h | 11 +++++++---- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 8bffdc406..0f94a5f36 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -571,9 +571,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 +607,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 +616,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) { @@ -1662,15 +1662,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; } diff --git a/src/bin/lttng-sessiond/consumer.h b/src/bin/lttng-sessiond/consumer.h index 11c98773e..b08cb546a 100644 --- a/src/bin/lttng-sessiond/consumer.h +++ b/src/bin/lttng-sessiond/consumer.h @@ -45,6 +45,13 @@ struct consumer_socket { */ unsigned int registered; + /* + * Flag if relayd network sockets were sent to the consumer through this + * socket. + */ + unsigned int control_sock_sent; + unsigned int data_sock_sent; + struct lttng_ht_node_ulong node; }; @@ -107,10 +114,6 @@ struct consumer_net { /* Data path for network streaming. */ struct lttng_uri data; - - /* Flag if network sockets were sent to the consumer. */ - unsigned int control_sock_sent; - unsigned int data_sock_sent; }; /* -- 2.34.1