X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fnotification-thread-events.c;h=414e5dd8aec0afd90a685eb1a23a53f315b2e554;hb=5a6306f7bf0d3cca6ec732230d114a9df309cde2;hp=178b80fa2b59bbcc715ad23245924b7b0d48657a;hpb=0efb2ad7fc448283184e43d6fb0915febae45384;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index 178b80fa2..414e5dd8a 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -1134,9 +1134,11 @@ int notification_thread_client_subscribe(struct notification_client *client, */ CDS_INIT_LIST_HEAD(&condition_list_element->node); condition_list_element->condition = condition; + condition = NULL; cds_list_add(&condition_list_element->node, &client->condition_list); - client_list = get_client_list_from_condition(state, condition); + client_list = get_client_list_from_condition( + state, condition_list_element->condition); if (!client_list) { /* * No notification-emiting trigger registered with this @@ -1160,7 +1162,7 @@ int notification_thread_client_subscribe(struct notification_client *client, pthread_mutex_lock(&client_list->lock); cds_list_for_each_entry(trigger_ht_element, &client_list->triggers_list, client_list_trigger_node) { - if (evaluate_condition_for_client(trigger_ht_element->trigger, condition, + if (evaluate_condition_for_client(trigger_ht_element->trigger, condition_list_element->condition, client, state)) { WARN("[notification-thread] Evaluation of a condition on client subscription failed, aborting."); ret = -1; @@ -1189,10 +1191,12 @@ end: if (client_list) { notification_client_list_put(client_list); } + lttng_condition_destroy(condition); return ret; error: free(condition_list_element); free(client_list_element); + lttng_condition_destroy(condition); return ret; } @@ -2305,7 +2309,7 @@ static int handle_notification_thread_command_get_trigger( /* Not a fatal error if the trigger is not found. */ get_trigger_info_for_log(trigger, &trigger_name, &trigger_owner_uid); - ERR("Failed to retrieve registered version of trigger: trigger name = '%s', trigger owner uid = %d", + DBG("Failed to retrieve registered version of trigger: trigger name = '%s', trigger owner uid = %d", trigger_name, (int) trigger_owner_uid); ret = 0; @@ -2487,7 +2491,7 @@ bool is_trigger_action_notify(const struct lttng_trigger *trigger) if (action_type == LTTNG_ACTION_TYPE_NOTIFY) { is_notify = true; goto end; - } else if (action_type != LTTNG_ACTION_TYPE_GROUP) { + } else if (action_type != LTTNG_ACTION_TYPE_LIST) { goto end; } @@ -2603,7 +2607,7 @@ enum lttng_error_code setup_tracer_notifier( trigger, &error_counter_index); if (error_accounting_status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) { if (error_accounting_status == EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NO_INDEX_AVAILABLE) { - DBG("Trigger group error accounting counter full."); + DBG("Trigger list error accounting counter full."); ret = LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING_FULL; } else { ERR("Error registering trigger for error accounting"); @@ -2729,9 +2733,8 @@ int handle_notification_thread_command_register_trigger( trigger, &trigger_ht_element->node_by_name_uid); if (node != &trigger_ht_element->node_by_name_uid) { - /* Not a fatal error, simply report it to the client. */ - cds_lfht_del(state->triggers_ht, &trigger_ht_element->node); - *cmd_result = LTTNG_ERR_TRIGGER_EXISTS; + /* Internal error: add to triggers_ht should have failed. */ + ret = -1; goto error_free_ht_element; } @@ -3863,6 +3866,7 @@ int client_handle_message_subscription( goto end; } + /* Ownership of condition is always transferred. */ if (msg_type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE) { ret = notification_thread_client_subscribe( client, condition, state, &status);