From: Mathieu Desnoyers Date: Fri, 26 Apr 2013 14:24:14 +0000 (-0400) Subject: Fix: move metadata cache setup before ownership passing X-Git-Tag: v2.2.0-rc2~37 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=fc6432477fe8a5d3c4494acccdbe94c5912420bb;p=lttng-tools.git Fix: move metadata cache setup before ownership passing Signed-off-by: Mathieu Desnoyers Signed-off-by: David Goulet --- diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 0edb513f8..89b946896 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -898,10 +898,22 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, goto end_channel_error; } + if (msg.u.ask_channel.type == LTTNG_UST_CHAN_METADATA) { + ret = consumer_metadata_cache_allocate(channel); + if (ret < 0) { + ERR("Allocating metadata cache"); + goto end_channel_error; + } + consumer_timer_switch_start(channel, attr.switch_timer_interval); + attr.switch_timer_interval = 0; + } + /* * Add the channel to the internal state AFTER all streams were created * and successfully sent to session daemon. This way, all streams must * be ready before this channel is visible to the threads. + * If add_channel succeeds, ownership of the channel is + * passed to consumer_thread_channel_poll(). */ ret = add_channel(channel, ctx); if (ret < 0) { @@ -923,16 +935,6 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, goto end_nosignal; } - if (msg.u.ask_channel.type == LTTNG_UST_CHAN_METADATA) { - ret = consumer_metadata_cache_allocate(channel); - if (ret < 0) { - ERR("Allocating metadata cache"); - goto end_channel_error; - } - consumer_timer_switch_start(channel, attr.switch_timer_interval); - attr.switch_timer_interval = 0; - } - break; } case LTTNG_CONSUMER_GET_CHANNEL: