struct lttng_ht_iter iter;
struct ltt_ust_channel *uchan;
+ rcu_read_lock();
cds_lfht_for_each_entry(session->ust_session->domain_global.channels->ht,
&iter.iter, uchan, node.node) {
strncpy(channels[i].name, uchan->name, LTTNG_SYMBOL_NAME_LEN);
}
i++;
}
+ rcu_read_unlock();
break;
}
default:
assert(session);
+ rcu_read_lock();
+
if (session->consumer_fds_sent == 0 && session->consumer != NULL) {
cds_lfht_for_each_entry(session->consumer->socks->ht, &iter.iter,
socket, node.node) {
assert(socket->fd >= 0);
pthread_mutex_lock(socket->lock);
- ret = kernel_consumer_send_session(socket->fd, session);
+ ret = kernel_consumer_send_session(socket, session);
pthread_mutex_unlock(socket->lock);
if (ret < 0) {
ret = LTTNG_ERR_KERN_CONSUMER_FAIL;
}
error:
+ rcu_read_unlock();
return ret;
}
}
/* 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;
*/
static int send_consumer_relayd_socket(int domain, struct ltt_session *session,
struct lttng_uri *relayd_uri, struct consumer_output *consumer,
- int consumer_fd)
+ struct consumer_socket *consumer_sock)
{
int ret;
struct lttcomm_sock *sock = NULL;
}
/* Send relayd socket to consumer. */
- ret = consumer_send_relayd_socket(consumer_fd, sock,
- consumer, relayd_uri->stype);
+ ret = consumer_send_relayd_socket(consumer_sock, sock,
+ consumer, relayd_uri->stype, session->id);
if (ret < 0) {
ret = LTTNG_ERR_ENABLE_CONSUMER_FAIL;
goto close_sock;
/* 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;
* session.
*/
static int send_consumer_relayd_sockets(int domain,
- struct ltt_session *session, struct consumer_output *consumer, int fd)
+ struct ltt_session *session, struct consumer_output *consumer,
+ struct consumer_socket *sock)
{
int ret = LTTNG_OK;
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, fd);
+ &consumer->dst.net.control, consumer, sock);
if (ret != LTTNG_OK) {
goto error;
}
}
/* 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, fd);
+ &consumer->dst.net.data, consumer, sock);
if (ret != LTTNG_OK) {
goto error;
}
DBG2("Setting relayd for session %s", session->name);
+ rcu_read_lock();
+
if (usess && usess->consumer && usess->consumer->type == CONSUMER_DST_NET
&& usess->consumer->enabled) {
/* For each consumer socket, send relayd sockets */
pthread_mutex_lock(socket->lock);
ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_UST, session,
- usess->consumer, socket->fd);
+ usess->consumer, socket);
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
goto error;
pthread_mutex_lock(socket->lock);
ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_KERNEL, session,
- ksess->consumer, socket->fd);
+ ksess->consumer, socket);
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
goto error;
}
error:
+ rcu_read_unlock();
return ret;
}
usess = session->ust_session;
+ rcu_read_lock();
+
switch (domain) {
case LTTNG_DOMAIN_KERNEL:
{
ret = LTTNG_OK;
error:
+ rcu_read_unlock();
return ret;
}
DBG("Enabling channel %s for session %s", attr->name, session->name);
+ rcu_read_lock();
+
switch (domain) {
case LTTNG_DOMAIN_KERNEL:
{
}
error:
+ rcu_read_unlock();
return ret;
}
{
int ret;
+ rcu_read_lock();
+
switch (domain) {
case LTTNG_DOMAIN_KERNEL:
{
ret = LTTNG_OK;
error:
+ rcu_read_unlock();
return ret;
}
{
int ret;
+ rcu_read_lock();
+
switch (domain) {
case LTTNG_DOMAIN_KERNEL:
{
ret = LTTNG_OK;
error:
+ rcu_read_unlock();
return ret;
}
assert(event);
assert(channel_name);
+ rcu_read_lock();
+
switch (domain) {
case LTTNG_DOMAIN_KERNEL:
{
ret = LTTNG_OK;
error:
+ rcu_read_unlock();
return ret;
}
assert(session);
assert(channel_name);
+ rcu_read_lock();
+
switch (domain) {
case LTTNG_DOMAIN_KERNEL:
{
ret = LTTNG_OK;
error:
+ rcu_read_unlock();
return ret;
}
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;
}
pthread_mutex_lock(socket->lock);
ret = send_consumer_relayd_socket(domain, session, &uris[i],
- consumer, socket->fd);
+ consumer, socket);
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
rcu_read_unlock();