Enforce documented RCU preconditions with assertions
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-events.cpp
index 6f449fc638cef0df78f88c8abcc5d575f6376ad6..cf18f63f7f2d340a0a01703d046bf97a88d0b26a 100644 (file)
@@ -1313,6 +1313,8 @@ struct notification_client *get_client_from_socket(int socket,
        struct cds_lfht_node *node;
        struct notification_client *client = NULL;
 
+       ASSERT_RCU_READ_LOCKED();
+
        cds_lfht_lookup(state->client_socket_ht,
                        hash_client_socket(socket),
                        match_client_socket,
@@ -1341,6 +1343,8 @@ struct notification_client *get_client_from_id(notification_client_id id,
        struct cds_lfht_node *node;
        struct notification_client *client = NULL;
 
+       ASSERT_RCU_READ_LOCKED();
+
        cds_lfht_lookup(state->client_id_ht,
                        hash_client_id(id),
                        match_client_id,
@@ -1456,6 +1460,8 @@ struct lttng_session_trigger_list *get_session_trigger_list(
        struct cds_lfht_node *node;
        struct cds_lfht_iter iter;
 
+       ASSERT_RCU_READ_LOCKED();
+
        cds_lfht_lookup(state->session_triggers_ht,
                        hash_key_str(session_name, lttng_ht_seed),
                        match_session_trigger_list,
@@ -2418,6 +2424,8 @@ int bind_trigger_to_matching_session(struct lttng_trigger *trigger,
        const char *session_name;
        struct lttng_session_trigger_list *trigger_list;
 
+       ASSERT_RCU_READ_LOCKED();
+
        condition = lttng_trigger_get_const_condition(trigger);
        switch (lttng_condition_get_type(condition)) {
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING:
@@ -2464,6 +2472,8 @@ int bind_trigger_to_matching_channels(struct lttng_trigger *trigger,
        struct cds_lfht_iter iter;
        struct channel_info *channel;
 
+       ASSERT_RCU_READ_LOCKED();
+
        cds_lfht_for_each_entry(state->channels_ht, &iter, channel,
                        channels_ht_node) {
                struct lttng_trigger_list_element *trigger_list_element;
@@ -3402,6 +3412,8 @@ int notification_thread_client_disconnect(
        int ret;
        struct lttng_condition_list_element *condition_list_element, *tmp;
 
+       ASSERT_RCU_READ_LOCKED();
+
        /* Acquire the client lock to disable its communication atomically. */
        pthread_mutex_lock(&client->lock);
        client->communication.active = false;
This page took 0.026688 seconds and 4 git commands to generate.