projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: sessiond consumer thread should register as RCU thread
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
ust-consumer.c
diff --git
a/src/bin/lttng-sessiond/ust-consumer.c
b/src/bin/lttng-sessiond/ust-consumer.c
index ee56d6dea67b61406fd1d5ba946c03a23e6612a3..6410a1eed692df9a62d15bdf7765b4e40d16d001 100644
(file)
--- a/
src/bin/lttng-sessiond/ust-consumer.c
+++ b/
src/bin/lttng-sessiond/ust-consumer.c
@@
-72,7
+72,7
@@
static char *setup_trace_path(struct consumer_output *consumer,
ret = run_as_mkdir_recursive(pathname, S_IRWXU | S_IRWXG,
ua_sess->euid, ua_sess->egid);
if (ret < 0) {
ret = run_as_mkdir_recursive(pathname, S_IRWXU | S_IRWXG,
ua_sess->euid, ua_sess->egid);
if (ret < 0) {
- if (
ret != -
EEXIST) {
+ if (
errno !=
EEXIST) {
ERR("Trace directory creation error");
goto error;
}
ERR("Trace directory creation error");
goto error;
}
@@
-102,7
+102,7
@@
static int ask_channel_creation(struct ust_app_session *ua_sess,
struct ust_app_channel *ua_chan, struct consumer_output *consumer,
struct consumer_socket *socket, struct ust_registry_session *registry)
{
struct ust_app_channel *ua_chan, struct consumer_output *consumer,
struct consumer_socket *socket, struct ust_registry_session *registry)
{
- int ret;
+ int ret
, output
;
uint32_t chan_id;
uint64_t key, chan_reg_key;
char *pathname = NULL;
uint32_t chan_id;
uint64_t key, chan_reg_key;
char *pathname = NULL;
@@
-141,6
+141,13
@@
static int ask_channel_creation(struct ust_app_session *ua_sess,
chan_id = chan_reg->chan_id;
}
chan_id = chan_reg->chan_id;
}
+ switch (ua_chan->attr.output) {
+ case LTTNG_UST_MMAP:
+ default:
+ output = LTTNG_EVENT_MMAP;
+ break;
+ }
+
consumer_init_ask_channel_comm_msg(&msg,
ua_chan->attr.subbuf_size,
ua_chan->attr.num_subbuf,
consumer_init_ask_channel_comm_msg(&msg,
ua_chan->attr.subbuf_size,
ua_chan->attr.num_subbuf,
@@
-148,7
+155,7
@@
static int ask_channel_creation(struct ust_app_session *ua_sess,
ua_chan->attr.switch_timer_interval,
ua_chan->attr.read_timer_interval,
ua_sess->live_timer_interval,
ua_chan->attr.switch_timer_interval,
ua_chan->attr.read_timer_interval,
ua_sess->live_timer_interval,
-
(int) ua_chan->attr.
output,
+ output,
(int) ua_chan->attr.type,
ua_sess->tracing_id,
pathname,
(int) ua_chan->attr.type,
ua_sess->tracing_id,
pathname,
@@
-217,14
+224,13
@@
int ust_consumer_ask_channel(struct ust_app_session *ua_sess,
}
pthread_mutex_lock(socket->lock);
}
pthread_mutex_lock(socket->lock);
-
ret = ask_channel_creation(ua_sess, ua_chan, consumer, socket, registry);
ret = ask_channel_creation(ua_sess, ua_chan, consumer, socket, registry);
+ pthread_mutex_unlock(socket->lock);
if (ret < 0) {
goto error;
}
error:
if (ret < 0) {
goto error;
}
error:
- pthread_mutex_unlock(socket->lock);
return ret;
}
return ret;
}
@@
-243,6
+249,7
@@
int ust_consumer_get_channel(struct consumer_socket *socket,
assert(ua_chan);
assert(socket);
assert(ua_chan);
assert(socket);
+ memset(&msg, 0, sizeof(msg));
msg.cmd_type = LTTNG_CONSUMER_GET_CHANNEL;
msg.u.get_channel.key = ua_chan->key;
msg.cmd_type = LTTNG_CONSUMER_GET_CHANNEL;
msg.u.get_channel.key = ua_chan->key;
@@
-300,7
+307,7
@@
int ust_consumer_get_channel(struct consumer_socket *socket,
cds_list_add_tail(&stream->list, &ua_chan->streams.head);
ua_chan->streams.count++;
cds_list_add_tail(&stream->list, &ua_chan->streams.head);
ua_chan->streams.count++;
- DBG2("UST app stream %d received succesfully", ua_chan->streams.count);
+ DBG2("UST app stream %d received succes
s
fully", ua_chan->streams.count);
}
/* This MUST match or else we have a synchronization problem. */
}
/* This MUST match or else we have a synchronization problem. */
@@
-337,6
+344,7
@@
int ust_consumer_destroy_channel(struct consumer_socket *socket,
assert(ua_chan);
assert(socket);
assert(ua_chan);
assert(socket);
+ memset(&msg, 0, sizeof(msg));
msg.cmd_type = LTTNG_CONSUMER_DESTROY_CHANNEL;
msg.u.destroy_channel.key = ua_chan->key;
msg.cmd_type = LTTNG_CONSUMER_DESTROY_CHANNEL;
msg.u.destroy_channel.key = ua_chan->key;
@@
-374,8
+382,8
@@
int ust_consumer_send_stream_to_ust(struct ust_app *app,
ret = ustctl_send_stream_to_ust(app->sock, channel->obj, stream->obj);
if (ret < 0) {
if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
ret = ustctl_send_stream_to_ust(app->sock, channel->obj, stream->obj);
if (ret < 0) {
if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
- ERR("
Error ustctl send stream %s
to app pid: %d with ret %d",
- stream->
nam
e, app->pid, ret);
+ ERR("
ustctl send stream handle %d
to app pid: %d with ret %d",
+ stream->
obj->handl
e, app->pid, ret);
} else {
DBG3("UST app send stream to ust failed. Application is dead.");
}
} else {
DBG3("UST app send stream to ust failed. Application is dead.");
}
@@
-438,12
+446,12
@@
int ust_consumer_metadata_request(struct consumer_socket *socket)
assert(socket);
rcu_read_lock();
assert(socket);
rcu_read_lock();
- pthread_mutex_lock(socket->lock);
-
health_code_update();
/* Wait for a metadata request */
health_code_update();
/* Wait for a metadata request */
+ pthread_mutex_lock(socket->lock);
ret = consumer_socket_recv(socket, &request, sizeof(request));
ret = consumer_socket_recv(socket, &request, sizeof(request));
+ pthread_mutex_unlock(socket->lock);
if (ret < 0) {
goto end;
}
if (ret < 0) {
goto end;
}
@@
-462,6
+470,7
@@
int ust_consumer_metadata_request(struct consumer_socket *socket)
DBG("PID registry not found for session id %" PRIu64,
request.session_id_per_pid);
DBG("PID registry not found for session id %" PRIu64,
request.session_id_per_pid);
+ memset(&msg, 0, sizeof(msg));
msg.cmd_type = LTTNG_ERR_UND;
(void) consumer_send_msg(socket, &msg);
/*
msg.cmd_type = LTTNG_ERR_UND;
(void) consumer_send_msg(socket, &msg);
/*
@@
-477,17
+486,21
@@
int ust_consumer_metadata_request(struct consumer_socket *socket)
}
assert(ust_reg);
}
assert(ust_reg);
+ pthread_mutex_lock(&ust_reg->lock);
ret_push = ust_app_push_metadata(ust_reg, socket, 1);
ret_push = ust_app_push_metadata(ust_reg, socket, 1);
- if (ret_push < 0) {
+ pthread_mutex_unlock(&ust_reg->lock);
+ if (ret_push == -EPIPE) {
+ DBG("Application or relay closed while pushing metadata");
+ } else if (ret_push < 0) {
ERR("Pushing metadata");
ret = -1;
goto end;
ERR("Pushing metadata");
ret = -1;
goto end;
+ } else {
+ DBG("UST Consumer metadata pushed successfully");
}
}
- DBG("UST Consumer metadata pushed successfully");
ret = 0;
end:
ret = 0;
end:
- pthread_mutex_unlock(socket->lock);
rcu_read_unlock();
return ret;
}
rcu_read_unlock();
return ret;
}
This page took
0.025846 seconds
and
4
git commands to generate.