Fix: move metadata cache setup before ownership passing
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 26 Apr 2013 14:24:14 +0000 (10:24 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 26 Apr 2013 15:26:39 +0000 (11:26 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/ust-consumer/ust-consumer.c

index 0edb513f89c15263b2244983dcbf22626f95c734..89b946896fc2858844be1f63c77bbd55c9e7642a 100644 (file)
@@ -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:
This page took 0.027764 seconds and 5 git commands to generate.