Fix: add globally visible flag in stream
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.c
index f318af153ca3aca1dcdd1573590d7447de61490c..3330ff522cdeea40fd47b1cc8dd60f72aedf7f37 100644 (file)
@@ -152,7 +152,8 @@ static struct lttng_consumer_stream *allocate_stream(int cpu, int key,
                        channel->session_id,
                        cpu,
                        &alloc_ret,
-                       channel->type);
+                       channel->type,
+                       channel->monitor);
        if (stream == NULL) {
                switch (alloc_ret) {
                case -ENOENT:
@@ -559,6 +560,12 @@ static int send_streams_to_thread(struct lttng_consumer_channel *channel,
 
                /* Remove node from the channel stream list. */
                cds_list_del(&stream->send_node);
+
+               /*
+                * From this point on, the stream's ownership has been moved away from
+                * the channel and becomes globally visible.
+                */
+               stream->globally_visible = 1;
        }
 
 error:
@@ -726,7 +733,7 @@ static int setup_metadata(struct lttng_consumer_local_data *ctx, uint64_t key)
        if (cds_list_empty(&metadata->streams.head)) {
                ERR("Metadata channel key %" PRIu64 ", no stream available.", key);
                ret = LTTCOMM_CONSUMERD_ERROR_METADATA;
-               goto error;
+               goto error_no_stream;
        }
 
        /* Send metadata stream to relayd if needed. */
@@ -758,7 +765,9 @@ error:
         * the stream is still in the local stream list of the channel. This call
         * will make sure to clean that list.
         */
-       consumer_del_channel(metadata);
+       cds_list_del(&metadata->metadata_stream->send_node);
+       consumer_stream_destroy(metadata->metadata_stream, NULL);
+error_no_stream:
 end:
        return ret;
 }
This page took 0.023353 seconds and 4 git commands to generate.