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:11:34 +0000 (21:11 +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 a5943fd33ae6f8f858af5c61e3504a70dbceb2e1..7607e21fd132d325d8305999b90397c1ab9d8ea8 100644 (file)
@@ -129,6 +129,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));
@@ -252,6 +253,7 @@ void consumer_wait_metadata_cache_flushed(struct lttng_consumer_channel *channel
                uint64_t offset, bool invoked_by_timer)
 {
        assert(channel);
+       assert(!channel->is_deleted);
        assert(channel->metadata_cache);
 
        if (consumer_metadata_cache_is_flushed(channel, offset, invoked_by_timer)) {
index b6bde28b323dbd37b14bec868f87bddf7a2de27c..785047d7c5803db44ed2b7d877e834811c8586b4 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;
@@ -283,6 +284,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;
@@ -376,6 +378,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) {
@@ -439,6 +442,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,
@@ -513,6 +517,7 @@ int consumer_timer_monitor_start(struct lttng_consumer_channel *channel,
 
        assert(channel);
        assert(channel->key);
+       assert(!channel->is_deleted);
        assert(!channel->monitor_timer_enabled);
 
        ret = consumer_channel_timer_start(&channel->monitor_timer, channel,
index ff88c7f1ef31f0ef33ea5ab8d26e8c09b81813ca..0e7970f39e9a73a837252a3d7f8d3c011a314614 100644 (file)
@@ -2168,7 +2168,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 af605052be6a067febbe3547e208f09f90995a4a..7ffbaaa8e03545018bb5c52f817e9239ca7f03e5 100644 (file)
@@ -101,6 +101,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) {
@@ -136,6 +137,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(
@@ -258,6 +260,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);
 
        /*
@@ -393,6 +396,7 @@ static int create_ust_channel(struct lttng_consumer_channel *channel,
        struct lttng_ust_ctl_consumer_channel *ust_channel;
 
        assert(channel);
+       assert(!channel->is_deleted);
        assert(attr);
        assert(ust_chanp);
        assert(channel->buffer_credentials.is_set);
@@ -511,6 +515,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);
 
@@ -607,6 +612,7 @@ static int ask_channel(struct lttng_consumer_local_data *ctx,
 
        assert(ctx);
        assert(channel);
+       assert(!channel->is_deleted);
        assert(attr);
 
        /*
@@ -665,6 +671,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. */
@@ -3322,6 +3329,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.030747 seconds and 4 git commands to generate.