Fix: Do not null out lttng_consumer_stream channel on deletion
authorKienan Stewart <kstewart@efficios.com>
Tue, 16 Jul 2024 13:31:52 +0000 (09:31 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 22 Aug 2024 21:14:11 +0000 (21:14 +0000)
Change-Id: Ic98a27e6704d2683d24b8645d345955cee8b038c
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/consumer/consumer-metadata-cache.c
src/common/consumer/consumer-timer.c
src/common/consumer/consumer.c
src/common/ust-consumer/ust-consumer.c

index acb6cfe39c9fbee6a8cbe44b66e786a83d654cab..88b8ecb09dfdd33f97b78ec9b2ddb03227ba801d 100644 (file)
@@ -169,6 +169,7 @@ int consumer_metadata_cache_allocate(struct lttng_consumer_channel *channel)
        int ret;
 
        assert(channel);
+       assert(!channel->is_deleted);
 
        channel->metadata_cache = zmalloc(
                        sizeof(struct consumer_metadata_cache));
@@ -233,6 +234,7 @@ int consumer_metadata_cache_flushed(struct lttng_consumer_channel *channel,
        struct lttng_consumer_stream *metadata_stream;
 
        assert(channel);
+       assert(!channel->is_deleted);
        assert(channel->metadata_cache);
 
        /*
index ecd920717095fa16cd3b76f061204c1c40250207..d19215a5034a28e0c17f1ff3d4ca8510fc73ec8f 100644 (file)
@@ -85,6 +85,7 @@ static void metadata_switch_timer(struct lttng_consumer_local_data *ctx,
 
        channel = si->si_value.sival_ptr;
        assert(channel);
+       assert(!channel->is_deleted);
 
        if (channel->switch_timer_error) {
                return;
@@ -279,6 +280,7 @@ static void live_timer(struct lttng_consumer_local_data *ctx,
 
        channel = si->si_value.sival_ptr;
        assert(channel);
+       assert(!channel->is_deleted);
 
        if (channel->switch_timer_error) {
                goto error;
@@ -372,6 +374,7 @@ int consumer_channel_timer_start(timer_t *timer_id,
        struct itimerspec its;
 
        assert(channel);
+       assert(!channel->is_deleted);
        assert(channel->key);
 
        if (timer_interval_us == 0) {
@@ -435,6 +438,7 @@ void consumer_timer_switch_start(struct lttng_consumer_channel *channel,
        int ret;
 
        assert(channel);
+       assert(!channel->is_deleted);
        assert(channel->key);
 
        ret = consumer_channel_timer_start(&channel->switch_timer, channel,
@@ -508,6 +512,7 @@ int consumer_timer_monitor_start(struct lttng_consumer_channel *channel,
        int ret;
 
        assert(channel);
+       assert(!channel->is_deleted);
        assert(channel->key);
        assert(!channel->monitor_timer_enabled);
 
index c457f754d230598ab52b7cd871c013449803e33a..bc51ebac03f19df62a87e5feaffd4e110aaee72f 100644 (file)
@@ -2178,7 +2178,6 @@ void consumer_del_metadata_stream(struct lttng_consumer_stream *stream,
                /* Go for channel deletion! */
                free_channel = true;
        }
-       stream->chan = NULL;
 
        /*
         * Nullify the stream reference so it is not used after deletion. The
index 65543ddf27fe30590fdf1365cce418e811b95603..85ddec6d43ad71eb7c9e2c4a11b10404c8a991ca 100644 (file)
@@ -97,6 +97,7 @@ static int add_channel(struct lttng_consumer_channel *channel,
        int ret = 0;
 
        assert(channel);
+       assert(!channel->is_deleted);
        assert(ctx);
 
        if (ctx->on_recv_channel != NULL) {
@@ -132,6 +133,7 @@ static struct lttng_consumer_stream *allocate_stream(int cpu, int key,
        struct lttng_consumer_stream *stream = NULL;
 
        assert(channel);
+       assert(!channel->is_deleted);
        assert(ctx);
 
        stream = consumer_stream_create(
@@ -254,6 +256,7 @@ static int create_ust_streams(struct lttng_consumer_channel *channel,
        pthread_mutex_t *current_stream_lock = NULL;
 
        assert(channel);
+       assert(!channel->is_deleted);
        assert(ctx);
 
        /*
@@ -430,6 +433,7 @@ static int create_ust_channel(struct lttng_consumer_channel *channel,
        struct ustctl_consumer_channel *ust_channel;
 
        assert(channel);
+       assert(!channel->is_deleted);
        assert(attr);
        assert(ust_chanp);
        assert(channel->buffer_credentials.is_set);
@@ -544,6 +548,7 @@ static int send_channel_to_sessiond_and_relayd(int sock,
        uint64_t net_seq_idx = -1ULL;
 
        assert(channel);
+       assert(!channel->is_deleted);
        assert(ctx);
        assert(sock >= 0);
 
@@ -640,6 +645,7 @@ static int ask_channel(struct lttng_consumer_local_data *ctx,
 
        assert(ctx);
        assert(channel);
+       assert(!channel->is_deleted);
        assert(attr);
 
        /*
@@ -698,6 +704,7 @@ static int send_streams_to_thread(struct lttng_consumer_channel *channel,
        struct lttng_consumer_stream *stream, *stmp;
 
        assert(channel);
+       assert(!channel->is_deleted);
        assert(ctx);
 
        /* Send streams to the corresponding thread. */
@@ -3250,6 +3257,7 @@ int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
        int ret;
 
        assert(channel);
+       assert(!channel->is_deleted);
        assert(channel->metadata_cache);
 
        memset(&request, 0, sizeof(request));
This page took 0.032327 seconds and 4 git commands to generate.