X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fnotification-thread-events.c;h=0836620b59262413c43b8cb97addb8e0f468746b;hb=ecc7ed07fdfd1469f4b3c087e55cbae75f481e58;hp=ee20725dd318c3a167053d20b6da2fb03f8fed64;hpb=091fa780af74dc1a93eaeff50d8c0baf1de8c41f;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 ee20725dd..0836620b5 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -1089,6 +1089,7 @@ int notification_thread_client_subscribe(struct notification_client *client, struct notification_client_list *client_list = NULL; struct lttng_condition_list_element *condition_list_element = NULL; struct notification_client_list_element *client_list_element = NULL; + struct lttng_trigger_ht_element *trigger_ht_element; enum lttng_notification_channel_status status = LTTNG_NOTIFICATION_CHANNEL_STATUS_OK; @@ -1138,11 +1139,11 @@ int notification_thread_client_subscribe(struct notification_client *client, * at this point so that conditions that are already TRUE result * in a notification being sent out. * - * The client_list's trigger is used without locking the list itself. - * This is correct since the list doesn't own the trigger and the - * object is immutable. + * Note the iteration on all triggers which share an identical + * `condition` than the one to which the client is registering. This is + * done to ensure that the client receives a distinct notification for + * all triggers that have a `notify` action that have this condition. */ - struct lttng_trigger_ht_element *trigger_ht_element; pthread_mutex_lock(&client_list->lock); cds_list_for_each_entry(trigger_ht_element, &client_list->triggers_list, client_list_trigger_node) { @@ -1151,6 +1152,7 @@ int notification_thread_client_subscribe(struct notification_client *client, WARN("[notification-thread] Evaluation of a condition on client subscription failed, aborting."); ret = -1; free(client_list_element); + pthread_mutex_unlock(&client_list->lock); goto end; } } @@ -4212,8 +4214,7 @@ int send_evaluation_to_clients(const struct lttng_trigger *trigger, }; return notification_client_list_send_evaluation(client_list, - lttng_trigger_get_const_condition(trigger), evaluation, - lttng_trigger_get_credentials(trigger), + trigger, evaluation, &creds, client_handle_transmission_status_wrapper, state); } @@ -4254,9 +4255,8 @@ int send_evaluation_to_clients(const struct lttng_trigger *trigger, LTTNG_HIDDEN int notification_client_list_send_evaluation( struct notification_client_list *client_list, - const struct lttng_condition *condition, + const struct lttng_trigger *trigger, const struct lttng_evaluation *evaluation, - const struct lttng_credentials *trigger_creds, const struct lttng_credentials *source_object_creds, report_client_transmission_result_cb client_report, void *user_data) @@ -4265,12 +4265,14 @@ int notification_client_list_send_evaluation( struct lttng_payload msg_payload; struct notification_client_list_element *client_list_element, *tmp; const struct lttng_notification notification = { - .condition = (struct lttng_condition *) condition, + .trigger = (struct lttng_trigger *) trigger, .evaluation = (struct lttng_evaluation *) evaluation, }; struct lttng_notification_channel_message msg_header = { .type = (int8_t) LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION, }; + const struct lttng_credentials *trigger_creds = + lttng_trigger_get_credentials(trigger); lttng_payload_init(&msg_payload); @@ -4550,7 +4552,6 @@ int dispatch_one_event_notifier_notification(struct notification_thread_state *s element->trigger), struct lttng_condition_on_event, parent), - trigger_name, notification->capture_buffer, notification->capture_buf_size, false);