projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: use error code path instead of break when errors happen before execl
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
main.c
diff --git
a/src/bin/lttng-sessiond/main.c
b/src/bin/lttng-sessiond/main.c
index 1964fe0cca3b80e57b8293d00aa12cfb92d18790..80ca3d7c04e42704a325bb8b2aedfee1db0d7837 100644
(file)
--- a/
src/bin/lttng-sessiond/main.c
+++ b/
src/bin/lttng-sessiond/main.c
@@
-564,8
+564,7
@@
static void wait_consumer(struct consumer_data *consumer_data)
ret = waitpid(consumer_data->pid, &status, 0);
if (ret == -1) {
PERROR("consumerd waitpid pid: %d", consumer_data->pid)
ret = waitpid(consumer_data->pid, &status, 0);
if (ret == -1) {
PERROR("consumerd waitpid pid: %d", consumer_data->pid)
- }
- if (!WIFEXITED(status)) {
+ } else if (!WIFEXITED(status)) {
ERR("consumerd termination with error: %d",
WEXITSTATUS(ret));
}
ERR("consumerd termination with error: %d",
WEXITSTATUS(ret));
}
@@
-1855,6
+1854,8
@@
static void *thread_dispatch_ust_registration(void *data)
.count = 0,
};
.count = 0,
};
+ rcu_register_thread();
+
health_register(health_sessiond, HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH);
if (testpoint(sessiond_thread_app_reg_dispatch)) {
health_register(health_sessiond, HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH);
if (testpoint(sessiond_thread_app_reg_dispatch)) {
@@
-1867,12
+1868,16
@@
static void *thread_dispatch_ust_registration(void *data)
DBG("[thread] Dispatch UST command started");
DBG("[thread] Dispatch UST command started");
-
while (!CMM_LOAD_SHARED(dispatch_thread_exit)
) {
+
for (;;
) {
health_code_update();
/* Atomically prepare the queue futex */
futex_nto1_prepare(&ust_cmd_queue.futex);
health_code_update();
/* Atomically prepare the queue futex */
futex_nto1_prepare(&ust_cmd_queue.futex);
+ if (CMM_LOAD_SHARED(dispatch_thread_exit)) {
+ break;
+ }
+
do {
struct ust_app *app = NULL;
ust_cmd = NULL;
do {
struct ust_app *app = NULL;
ust_cmd = NULL;
@@
-2088,6
+2093,7
@@
error_testpoint:
ERR("Health error occurred in %s", __func__);
}
health_unregister(health_sessiond);
ERR("Health error occurred in %s", __func__);
}
health_unregister(health_sessiond);
+ rcu_unregister_thread();
return NULL;
}
return NULL;
}
@@
-2520,7
+2526,7
@@
static pid_t spawn_consumerd(struct consumer_data *consumer_data)
} else {
DBG("Could not find any valid consumerd executable");
ret = -EINVAL;
} else {
DBG("Could not find any valid consumerd executable");
ret = -EINVAL;
-
break
;
+
goto error
;
}
DBG("Using kernel consumer at: %s", consumer_to_use);
ret = execl(consumer_to_use,
}
DBG("Using kernel consumer at: %s", consumer_to_use);
ret = execl(consumer_to_use,
@@
-3058,7
+3064,6
@@
static int process_client_msg(struct command_ctx *cmd_ctx, int sock,
case LTTNG_CREATE_SESSION:
case LTTNG_CREATE_SESSION_SNAPSHOT:
case LTTNG_CREATE_SESSION_LIVE:
case LTTNG_CREATE_SESSION:
case LTTNG_CREATE_SESSION_SNAPSHOT:
case LTTNG_CREATE_SESSION_LIVE:
- case LTTNG_CALIBRATE:
case LTTNG_LIST_SESSIONS:
case LTTNG_LIST_TRACEPOINTS:
case LTTNG_LIST_SYSCALLS:
case LTTNG_LIST_SESSIONS:
case LTTNG_LIST_TRACEPOINTS:
case LTTNG_LIST_SYSCALLS:
@@
-3900,12
+3905,6
@@
error_add_context:
ret = LTTNG_OK;
break;
}
ret = LTTNG_OK;
break;
}
- case LTTNG_CALIBRATE:
- {
- ret = cmd_calibrate(cmd_ctx->lsm->domain.type,
- &cmd_ctx->lsm->u.calibrate);
- break;
- }
case LTTNG_REGISTER_CONSUMER:
{
struct consumer_data *cdata;
case LTTNG_REGISTER_CONSUMER:
{
struct consumer_data *cdata;
@@
-4332,7
+4331,7
@@
error:
}
lttng_poll_clean(&events);
}
lttng_poll_clean(&events);
-
+ stop_threads();
rcu_unregister_thread();
return NULL;
}
rcu_unregister_thread();
return NULL;
}
@@
-5370,9
+5369,6
@@
error:
static void sighandler(int sig)
{
switch (sig) {
static void sighandler(int sig)
{
switch (sig) {
- case SIGPIPE:
- DBG("SIGPIPE caught");
- return;
case SIGINT:
DBG("SIGINT caught");
stop_threads();
case SIGINT:
DBG("SIGINT caught");
stop_threads();
@@
-5404,9
+5400,10
@@
static int set_signal_handler(void)
return ret;
}
return ret;
}
- sa.sa_handler = sighandler;
sa.sa_mask = sigset;
sa.sa_flags = 0;
sa.sa_mask = sigset;
sa.sa_flags = 0;
+
+ sa.sa_handler = sighandler;
if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
PERROR("sigaction");
return ret;
if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
PERROR("sigaction");
return ret;
@@
-5417,12
+5414,13
@@
static int set_signal_handler(void)
return ret;
}
return ret;
}
- if ((ret = sigaction(SIG
PIPE
, &sa, NULL)) < 0) {
+ if ((ret = sigaction(SIG
USR1
, &sa, NULL)) < 0) {
PERROR("sigaction");
return ret;
}
PERROR("sigaction");
return ret;
}
- if ((ret = sigaction(SIGUSR1, &sa, NULL)) < 0) {
+ sa.sa_handler = SIG_IGN;
+ if ((ret = sigaction(SIGPIPE, &sa, NULL)) < 0) {
PERROR("sigaction");
return ret;
}
PERROR("sigaction");
return ret;
}
@@
-6155,6
+6153,12
@@
exit_client:
exit_health:
exit_init_data:
exit_health:
exit_init_data:
+ /*
+ * Wait for all pending call_rcu work to complete before tearing
+ * down data structures. call_rcu worker may be trying to
+ * perform lookups in those structures.
+ */
+ rcu_barrier();
/*
* sessiond_cleanup() is called when no other thread is running, except
* the ht_cleanup thread, which is needed to destroy the hash tables.
/*
* sessiond_cleanup() is called when no other thread is running, except
* the ht_cleanup thread, which is needed to destroy the hash tables.
This page took
0.026103 seconds
and
4
git commands to generate.