rcu_read_unlock();
}
- call_rcu(&channel->node.head, free_channel_rcu);
+ channel->is_deleted = true;
+ call_rcu(&channel->node.head, free_channel_rcu);
end:
pthread_mutex_unlock(&channel->lock);
pthread_mutex_unlock(&consumer_data.lock);
unsigned long channel_hash;
pthread_mutex_lock(&channel->lock);
+ if (channel->is_deleted) {
+ /*
+ * The channel has been logically deleted and should no longer
+ * be used. It has released its reference to its current trace
+ * chunk and should not acquire a new one.
+ *
+ * Return success as there is nothing for the caller to do.
+ */
+ goto end;
+ }
/*
* A stream can transition to a state where it and its channel
* no longer belong to a trace chunk. For instance, this happens when
struct lttng_consumer_channel {
/* Is the channel published in the channel hash tables? */
bool is_published;
+ /*
+ * Was the channel deleted (logically) and waiting to be reclaimed?
+ * If this flag is set, no modification that is not cleaned-up by the
+ * RCU reclamation callback should be made
+ */
+ bool is_deleted;
/* HT node used for consumer_data.channel_ht */
struct lttng_ht_node_u64 node;
/* HT node used for consumer_data.channels_by_session_id_ht */