[lttng-dev] [PATCH lttng-tools stable-2.6] Fix: free ust channel object after grace period in consumer

Jérémie Galarneau jeremie.galarneau at efficios.com
Sat May 14 20:12:01 UTC 2016


Merged in stable-2.6. Thanks!

Jérémie

On Wed, Apr 27, 2016 at 4:28 PM, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> [ Backport from master branch
> commit b83e03c499 "Fix: free metadata cache after grace period in consumer" ]
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
>  src/common/consumer.c                  | 11 +++++++++++
>  src/common/ust-consumer/ust-consumer.c |  8 ++++++++
>  src/common/ust-consumer/ust-consumer.h |  6 ++++++
>  3 files changed, 25 insertions(+)
>
> diff --git a/src/common/consumer.c b/src/common/consumer.c
> index 2dd31ff..9a3bf86 100644
> --- a/src/common/consumer.c
> +++ b/src/common/consumer.c
> @@ -285,6 +285,17 @@ static void free_channel_rcu(struct rcu_head *head)
>         struct lttng_consumer_channel *channel =
>                 caa_container_of(node, struct lttng_consumer_channel, node);
>
> +       switch (consumer_data.type) {
> +       case LTTNG_CONSUMER_KERNEL:
> +               break;
> +       case LTTNG_CONSUMER32_UST:
> +       case LTTNG_CONSUMER64_UST:
> +               lttng_ustconsumer_free_channel(channel);
> +               break;
> +       default:
> +               ERR("Unknown consumer_data type");
> +               abort();
> +       }
>         free(channel);
>  }
>
> diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c
> index 28b7f10..152455c 100644
> --- a/src/common/ust-consumer/ust-consumer.c
> +++ b/src/common/ust-consumer/ust-consumer.c
> @@ -79,6 +79,7 @@ static void destroy_channel(struct lttng_consumer_channel *channel)
>          */
>         if (channel->uchan) {
>                 lttng_ustconsumer_del_channel(channel);
> +               lttng_ustconsumer_free_channel(channel);
>         }
>         free(channel);
>  }
> @@ -1687,6 +1688,13 @@ void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
>         if (chan->switch_timer_enabled == 1) {
>                 consumer_timer_switch_stop(chan);
>         }
> +}
> +
> +void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
> +{
> +       assert(chan);
> +       assert(chan->uchan);
> +
>         consumer_metadata_cache_destroy(chan);
>         ustctl_destroy_channel(chan->uchan);
>  }
> diff --git a/src/common/ust-consumer/ust-consumer.h b/src/common/ust-consumer/ust-consumer.h
> index 4357380..08f1fa8 100644
> --- a/src/common/ust-consumer/ust-consumer.h
> +++ b/src/common/ust-consumer/ust-consumer.h
> @@ -38,6 +38,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
>
>  extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan);
>  extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan);
> +extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan);
>  extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream);
>  extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream);
>
> @@ -120,6 +121,11 @@ void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
>  }
>
>  static inline
> +void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
> +{
> +}
> +
> +static inline
>  int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream)
>  {
>         return -ENOSYS;
> --
> 2.1.4
>



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list