X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Faction-executor.cpp;h=e2eeed45115cfb36583a9615fa9bd3ba767ce187;hb=f46376a14da2eb796690cb4e718e8b213839d6ea;hp=53d831354d21f19942def858f334241b14ac37ab;hpb=4a467a8486ceab94f4b7444457027fb75cd85a39;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/action-executor.cpp b/src/bin/lttng-sessiond/action-executor.cpp index 53d831354..e2eeed451 100644 --- a/src/bin/lttng-sessiond/action-executor.cpp +++ b/src/bin/lttng-sessiond/action-executor.cpp @@ -264,7 +264,7 @@ end: static int action_executor_notify_handler(struct action_executor *executor, const struct action_work_item *work_item, - struct action_work_subitem *item) + struct action_work_subitem *item __attribute__((unused))) { return notification_client_list_send_evaluation(work_item->client_list, work_item->trigger, @@ -276,7 +276,7 @@ static int action_executor_notify_handler(struct action_executor *executor, } static int action_executor_start_session_handler( - struct action_executor *executor, + struct action_executor *executor __attribute__((unused)), const struct action_work_item *work_item, struct action_work_subitem *item) { @@ -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); @@ -309,6 +309,7 @@ static int action_executor_start_session_handler( } session_lock_list(); + rcu_read_lock(); session = session_find_by_id(LTTNG_OPTIONAL_GET(item->context.session_id)); if (!session) { DBG("Failed to find session `%s` by name while executing `%s` action of trigger `%s`", @@ -320,7 +321,7 @@ static int action_executor_start_session_handler( session_lock(session); if (session->destroyed) { - DBG("Session '%s' with id = %" PRIu64 " is flagged as destroyed. Skipping: action = '%s', trigger = '%s'", + DBG("Session `%s` with id = %" PRIu64 " is flagged as destroyed. Skipping: action = `%s`, trigger = `%s`", session->name, session->id, get_action_name(action), get_trigger_name(work_item->trigger)); @@ -353,13 +354,14 @@ error_unlock_session: session_unlock(session); session_put(session); error_unlock_list: + rcu_read_unlock(); session_unlock_list(); end: return ret; } static int action_executor_stop_session_handler( - struct action_executor *executor, + struct action_executor *executor __attribute__((unused)), const struct action_work_item *work_item, struct action_work_subitem *item) { @@ -384,7 +386,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); @@ -392,6 +394,7 @@ static int action_executor_stop_session_handler( } session_lock_list(); + rcu_read_lock(); session = session_find_by_id(LTTNG_OPTIONAL_GET(item->context.session_id)); if (!session) { DBG("Failed to find session `%s` by name while executing `%s` action of trigger `%s`", @@ -403,7 +406,7 @@ static int action_executor_stop_session_handler( session_lock(session); if (session->destroyed) { - DBG("Session '%s' with id = %" PRIu64 " is flagged as destroyed. Skipping: action = '%s', trigger = '%s'", + DBG("Session `%s` with id = %" PRIu64 " is flagged as destroyed. Skipping: action = `%s`, trigger = `%s`", session->name, session->id, get_action_name(action), get_trigger_name(work_item->trigger)); @@ -436,13 +439,14 @@ error_unlock_session: session_unlock(session); session_put(session); error_unlock_list: + rcu_read_unlock(); session_unlock_list(); end: return ret; } static int action_executor_rotate_session_handler( - struct action_executor *executor, + struct action_executor *executor __attribute__((unused)), const struct action_work_item *work_item, struct action_work_subitem *item) { @@ -467,7 +471,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); @@ -475,6 +479,7 @@ static int action_executor_rotate_session_handler( } session_lock_list(); + rcu_read_lock(); session = session_find_by_id(LTTNG_OPTIONAL_GET(item->context.session_id)); if (!session) { DBG("Failed to find session `%s` by name while executing `%s` action of trigger `%s`", @@ -486,7 +491,7 @@ static int action_executor_rotate_session_handler( session_lock(session); if (session->destroyed) { - DBG("Session '%s' with id = %" PRIu64 " is flagged as destroyed. Skipping: action = '%s', trigger = '%s'", + DBG("Session `%s` with id = %" PRIu64 " is flagged as destroyed. Skipping: action = `%s`, trigger = `%s`", session->name, session->id, get_action_name(action), get_trigger_name(work_item->trigger)); @@ -526,13 +531,14 @@ error_unlock_session: session_unlock(session); session_put(session); error_unlock_list: + rcu_read_unlock(); session_unlock_list(); end: return ret; } static int action_executor_snapshot_session_handler( - struct action_executor *executor, + struct action_executor *executor __attribute__((unused)), const struct action_work_item *work_item, struct action_work_subitem *item) { @@ -553,7 +559,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); @@ -580,6 +586,7 @@ static int action_executor_snapshot_session_handler( } session_lock_list(); + rcu_read_lock(); session = session_find_by_id(LTTNG_OPTIONAL_GET(item->context.session_id)); if (!session) { DBG("Failed to find session `%s` by name while executing `%s` action of trigger `%s`", @@ -591,7 +598,7 @@ static int action_executor_snapshot_session_handler( session_lock(session); if (session->destroyed) { - DBG("Session '%s' with id = %" PRIu64 " is flagged as destroyed. Skipping: action = '%s', trigger = '%s'", + DBG("Session `%s` with id = %" PRIu64 " is flagged as destroyed. Skipping: action = `%s`, trigger = `%s`", session->name, session->id, get_action_name(action), get_trigger_name(work_item->trigger)); @@ -620,14 +627,16 @@ error_unlock_session: session_unlock(session); session_put(session); error_unlock_list: + rcu_read_unlock(); session_unlock_list(); end: return ret; } -static int action_executor_list_handler(struct action_executor *executor, - const struct action_work_item *work_item, - struct action_work_subitem *item) +static int action_executor_list_handler( + struct action_executor *executor __attribute__((unused)), + const struct action_work_item *work_item __attribute__((unused)), + struct action_work_subitem *item __attribute__((unused))) { ERR("Execution of a list action by the action executor should never occur"); abort(); @@ -752,7 +761,7 @@ static void *action_executor_thread(void *_data) work_item->trigger, &trigger_owner_uid); LTTNG_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; @@ -872,6 +881,7 @@ enum action_executor_status action_executor_enqueue_trigger( bool signal = false; LTTNG_ASSERT(trigger); + ASSERT_RCU_READ_LOCKED(); pthread_mutex_lock(&executor->work.lock); /* Check for queue overflow. */ @@ -885,7 +895,7 @@ enum action_executor_status action_executor_enqueue_trigger( work_item = (action_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;