Fix: increment UST channel refcount at stream creation
[lttng-tools.git] / src / common / consumer.c
index c4518cc03a7d8891715704cd40a8983f50d08650..e26388f8e50fab81d5df0999ab5fb73948e8faba 100644 (file)
@@ -99,6 +99,8 @@ static void notify_channel_pipe(struct lttng_consumer_local_data *ctx,
        struct consumer_channel_msg msg;
        int ret;
 
+       memset(&msg, 0, sizeof(msg));
+
        msg.action = action;
        msg.chan = chan;
        do {
@@ -658,9 +660,6 @@ static int add_stream(struct lttng_consumer_stream *stream,
                uatomic_inc(&relayd->refcount);
        }
 
-       /* Update channel refcount once added without error(s). */
-       uatomic_inc(&stream->chan->refcount);
-
        /*
         * When nb_init_stream_left reaches 0, we don't need to trigger any action
         * in terms of destroying the associated channel, because the action that
@@ -1424,6 +1423,8 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap(
                                goto end;
                        }
                        outfd = stream->out_fd = ret;
+                       /* Reset current size because we just perform a rotation. */
+                       stream->tracefile_size_current = 0;
                }
                stream->tracefile_size_current += len;
        }
@@ -1604,6 +1605,8 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(
                                goto end;
                        }
                        outfd = stream->out_fd = ret;
+                       /* Reset current size because we just perform a rotation. */
+                       stream->tracefile_size_current = 0;
                }
                stream->tracefile_size_current += len;
        }
This page took 0.028095 seconds and 4 git commands to generate.