X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Faction-executor.c;h=1908ce58d547a43ce3aadb2527ec66a5f0072114;hb=6c99c58315c08a769c8192cc9d9566e45c11eef1;hp=8b8aba7618dc1836229bb2c597c0cb4658edab2e;hpb=7d4ef9530275ce3430ff434c4a08d2d8ad25f885;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/action-executor.c b/src/bin/lttng-sessiond/action-executor.c index 8b8aba761..1908ce58d 100644 --- a/src/bin/lttng-sessiond/action-executor.c +++ b/src/bin/lttng-sessiond/action-executor.c @@ -301,7 +301,7 @@ static int action_executor_start_session_handler( * existed. If not skip the action altogether. */ if (!item->context.session_id.is_set) { - DBG("Session `%s` was not present at the moment the work item was enqueued for %s` action of trigger `%s`", + DBG("Session `%s` was not present at the moment the work item was enqueued for `%s` action of trigger `%s`", session_name, get_action_name(action), get_trigger_name(work_item->trigger)); lttng_action_increase_execution_failure_count(action); @@ -325,18 +325,18 @@ static int action_executor_start_session_handler( if (session->id != LTTNG_OPTIONAL_GET(item->context.session_id)) { DBG("Session id for session `%s` (id: %" PRIu64 " is not the same that was sampled (id: %" PRIu64 - " at the moment the work item was enqueued for %s` action of trigger `%s`", + " at the moment the work item was enqueued for `%s` action of trigger `%s`", session_name, session->id, LTTNG_OPTIONAL_GET(item->context.session_id), get_action_name(action), get_trigger_name(work_item->trigger)); ret = 0; - goto error_unlock_list; + goto error_put_session; } session_lock(session); if (!is_trigger_allowed_for_session(work_item->trigger, session)) { - goto error_dispose_session; + goto error_unlock_session; } cmd_ret = cmd_start_trace(session); @@ -357,8 +357,9 @@ static int action_executor_start_session_handler( break; } -error_dispose_session: +error_unlock_session: session_unlock(session); +error_put_session: session_put(session); error_unlock_list: session_unlock_list(); @@ -392,7 +393,7 @@ static int action_executor_stop_session_handler( * existed. If not, skip the action altogether. */ if (!item->context.session_id.is_set) { - DBG("Session `%s` was not present at the moment the work item was enqueued for %s` action of trigger `%s`", + DBG("Session `%s` was not present at the moment the work item was enqueued for `%s` action of trigger `%s`", session_name, get_action_name(action), get_trigger_name(work_item->trigger)); lttng_action_increase_execution_failure_count(action); @@ -417,18 +418,18 @@ static int action_executor_stop_session_handler( if (session->id != LTTNG_OPTIONAL_GET(item->context.session_id)) { DBG("Session id for session `%s` (id: %" PRIu64 " is not the same that was sampled (id: %" PRIu64 - " at the moment the work item was enqueued for %s` action of trigger `%s`", + " at the moment the work item was enqueued for `%s` action of trigger `%s`", session_name, session->id, LTTNG_OPTIONAL_GET(item->context.session_id), get_action_name(action), get_trigger_name(work_item->trigger)); ret = 0; - goto error_unlock_list; + goto error_put_session; } session_lock(session); if (!is_trigger_allowed_for_session(work_item->trigger, session)) { - goto error_dispose_session; + goto error_unlock_session; } cmd_ret = cmd_stop_trace(session); @@ -449,8 +450,9 @@ static int action_executor_stop_session_handler( break; } -error_dispose_session: +error_unlock_session: session_unlock(session); +error_put_session: session_put(session); error_unlock_list: session_unlock_list(); @@ -484,7 +486,7 @@ static int action_executor_rotate_session_handler( * existed. If not, skip the action altogether. */ if (!item->context.session_id.is_set) { - DBG("Session `%s` was not present at the moment the work item was enqueued for %s` action of trigger `%s`", + DBG("Session `%s` was not present at the moment the work item was enqueued for `%s` action of trigger `%s`", session_name, get_action_name(action), get_trigger_name(work_item->trigger)); lttng_action_increase_execution_failure_count(action); @@ -509,18 +511,18 @@ static int action_executor_rotate_session_handler( if (session->id != LTTNG_OPTIONAL_GET(item->context.session_id)) { DBG("Session id for session `%s` (id: %" PRIu64 " is not the same that was sampled (id: %" PRIu64 - " at the moment the work item was enqueued for %s` action of trigger `%s`", + " at the moment the work item was enqueued for `%s` action of trigger `%s`", session_name, session->id, LTTNG_OPTIONAL_GET(item->context.session_id), get_action_name(action), get_trigger_name(work_item->trigger)); ret = 0; - goto error_unlock_list; + goto error_put_session; } session_lock(session); if (!is_trigger_allowed_for_session(work_item->trigger, session)) { - goto error_dispose_session; + goto error_unlock_session; } cmd_ret = cmd_rotate_session(session, NULL, false, @@ -548,8 +550,9 @@ static int action_executor_rotate_session_handler( break; } -error_dispose_session: +error_unlock_session: session_unlock(session); +error_put_session: session_put(session); error_unlock_list: session_unlock_list(); @@ -579,7 +582,7 @@ static int action_executor_snapshot_session_handler( * existed. If not, skip the action altogether. */ if (!item->context.session_id.is_set) { - DBG("Session was not present at the moment the work item was enqueued for %s` action of trigger `%s`", + DBG("Session was not present at the moment the work item was enqueued for `%s` action of trigger `%s`", get_action_name(action), get_trigger_name(work_item->trigger)); lttng_action_increase_execution_failure_count(action); @@ -623,18 +626,18 @@ static int action_executor_snapshot_session_handler( if (session->id != LTTNG_OPTIONAL_GET(item->context.session_id)) { DBG("Session id for session `%s` (id: %" PRIu64 " is not the same that was sampled (id: %" PRIu64 - " at the moment the work item was enqueued for %s` action of trigger `%s`", + " at the moment the work item was enqueued for `%s` action of trigger `%s`", session_name, session->id, LTTNG_OPTIONAL_GET(item->context.session_id), get_action_name(action), get_trigger_name(work_item->trigger)); ret = 0; - goto error_unlock_list; + goto error_put_session; } session_lock(session); if (!is_trigger_allowed_for_session(work_item->trigger, session)) { - goto error_dispose_session; + goto error_unlock_session; } cmd_ret = cmd_snapshot_record(session, snapshot_output, 0); @@ -651,8 +654,9 @@ static int action_executor_snapshot_session_handler( break; } -error_dispose_session: +error_unlock_session: session_unlock(session); +error_put_session: session_put(session); error_unlock_list: session_unlock_list(); @@ -748,7 +752,7 @@ static void *action_executor_thread(void *_data) DBG("Entering work execution loop"); pthread_mutex_lock(&executor->work.lock); while (!executor->should_quit) { - int ret; + int ret = 0; struct action_work_item *work_item; health_code_update(); @@ -787,7 +791,7 @@ static void *action_executor_thread(void *_data) work_item->trigger, &trigger_owner_uid); assert(trigger_status == LTTNG_TRIGGER_STATUS_OK); - DBG("Work item skipped since the associated trigger is no longer registered: work item id = %" PRIu64 ", trigger name = '%s', trigger owner uid = %d", + DBG("Work item skipped since the associated trigger is no longer registered: work item id = %" PRIu64 ", trigger name = `%s`, trigger owner uid = %d", work_item->id, trigger_name, (int) trigger_owner_uid); ret = 0; @@ -920,7 +924,7 @@ enum action_executor_status action_executor_enqueue_trigger( work_item = zmalloc(sizeof(*work_item)); if (!work_item) { - PERROR("Failed to allocate action executor work item: trigger name = '%s'", + PERROR("Failed to allocate action executor work item: trigger name = `%s`", get_trigger_name(trigger)); executor_status = ACTION_EXECUTOR_STATUS_ERROR; goto error_unlock; @@ -983,7 +987,7 @@ error_unlock: static int add_action_to_subitem_array(struct lttng_action *action, struct lttng_dynamic_array *subitems) { - int ret; + int ret = 0; enum lttng_action_type type = lttng_action_get_type(action); const char *session_name = NULL; enum lttng_action_status status;