From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] [PATCH lttng-tools stable-2.6] Fix: free ust channel object after grace period in consumer
Date: Wed, 27 Apr 2016 16:28:02 -0400 [thread overview]
Message-ID: <1461788882-14523-1-git-send-email-mathieu.desnoyers@efficios.com> (raw)
[ 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
reply other threads:[~2016-04-27 20:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461788882-14523-1-git-send-email-mathieu.desnoyers@efficios.com \
--to=mathieu.desnoyers@efficios.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox