X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Faction-executor.cpp;h=0b910d474ca3c01c0ee01c245d0c4c25c52b8a85;hb=2d7da3031c65c4569ff2428a7c2cad30007f3b50;hp=68c9c71cfed5fdebbeb54eb0c400ac02fa84f7c7;hpb=48b7cdc221a445188d6d9bd08fc1686837e71224;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/action-executor.cpp b/src/bin/lttng-sessiond/action-executor.cpp index 68c9c71cf..0b910d474 100644 --- a/src/bin/lttng-sessiond/action-executor.cpp +++ b/src/bin/lttng-sessiond/action-executor.cpp @@ -5,29 +5,29 @@ * */ -#include "action-executor.h" -#include "cmd.h" -#include "health-sessiond.h" -#include "lttng-sessiond.h" -#include "notification-thread-internal.h" -#include "session.h" -#include "thread.h" -#include -#include -#include -#include -#include +#include "action-executor.hpp" +#include "cmd.hpp" +#include "health-sessiond.hpp" +#include "lttng-sessiond.hpp" +#include "notification-thread-internal.hpp" +#include "session.hpp" +#include "thread.hpp" +#include +#include +#include +#include +#include #include -#include +#include #include #include #include #include #include #include -#include +#include #include -#include +#include #include #include #include @@ -233,6 +233,15 @@ static int client_handle_transmission_status( case CLIENT_TRANSMISSION_STATUS_COMPLETE: DBG("Successfully sent full notification to client, client_id = %" PRIu64, client->id); + /* + * There is no need to wake the (e)poll thread. If it was waiting for + * "out" events on the client's socket, it will see that no payload + * in queued and will unsubscribe from that event. + * + * In the other cases, we have to wake the the (e)poll thread to either + * handle the error on the client or to get it to monitor the client "out" + * events. + */ update_communication = false; break; case CLIENT_TRANSMISSION_STATUS_QUEUED: @@ -264,7 +273,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 +285,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) { @@ -309,6 +318,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`", @@ -353,13 +363,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) { @@ -392,6 +403,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`", @@ -436,13 +448,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) { @@ -475,6 +488,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`", @@ -526,13 +540,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) { @@ -580,6 +595,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`", @@ -620,14 +636,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(); @@ -812,7 +830,7 @@ static void clean_up_action_executor_thread(void *_data) struct action_executor *action_executor_create( struct notification_thread_handle *handle) { - struct action_executor *executor = (action_executor *) zmalloc(sizeof(*executor)); + struct action_executor *executor = zmalloc(); if (!executor) { goto end; @@ -884,7 +902,7 @@ enum action_executor_status action_executor_enqueue_trigger( goto error_unlock; } - work_item = (action_work_item *) zmalloc(sizeof(*work_item)); + work_item = zmalloc(); if (!work_item) { PERROR("Failed to allocate action executor work item: trigger name = `%s`", get_trigger_name(trigger));