projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: add missing free causing a memleak
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
buffer-registry.c
diff --git
a/src/bin/lttng-sessiond/buffer-registry.c
b/src/bin/lttng-sessiond/buffer-registry.c
index 5751b8d587f8a1a12a64a1b2fc207aaba22b0534..ad103d1dec36e2afcf7cfd1f9861feda044aa198 100644
(file)
--- a/
src/bin/lttng-sessiond/buffer-registry.c
+++ b/
src/bin/lttng-sessiond/buffer-registry.c
@@
-25,6
+25,7
@@
#include "fd-limit.h"
#include "ust-consumer.h"
#include "ust-ctl.h"
#include "fd-limit.h"
#include "ust-consumer.h"
#include "ust-ctl.h"
+#include "utils.h"
/*
* Set in main.c during initialization process of the daemon. This contains
/*
* Set in main.c during initialization process of the daemon. This contains
@@
-492,8
+493,7
@@
void buffer_reg_channel_destroy(struct buffer_reg_channel *regp,
return;
}
return;
}
- DBG3("Buffer registry channel destroy with key %" PRIu32 " and handle %d",
- regp->key, regp->obj.ust->handle);
+ DBG3("Buffer registry channel destroy with key %" PRIu32, regp->key);
switch (domain) {
case LTTNG_DOMAIN_UST:
switch (domain) {
case LTTNG_DOMAIN_UST:
@@
-527,8
+527,10
@@
void buffer_reg_channel_destroy(struct buffer_reg_channel *regp,
/*
* Destroy a buffer registry session with the given domain.
/*
* Destroy a buffer registry session with the given domain.
+ *
+ * Should *NOT* be called with RCU read-side lock held.
*/
*/
-void buffer_reg_session_destroy(struct buffer_reg_session *regp,
+
static
void buffer_reg_session_destroy(struct buffer_reg_session *regp,
enum lttng_domain_type domain)
{
int ret;
enum lttng_domain_type domain)
{
int ret;
@@
-545,9
+547,10
@@
void buffer_reg_session_destroy(struct buffer_reg_session *regp,
assert(!ret);
buffer_reg_channel_destroy(reg_chan, domain);
}
assert(!ret);
buffer_reg_channel_destroy(reg_chan, domain);
}
- lttng_ht_destroy(regp->channels);
rcu_read_unlock();
rcu_read_unlock();
+ ht_cleanup_push(regp->channels);
+
switch (domain) {
case LTTNG_DOMAIN_UST:
ust_registry_session_destroy(regp->reg.ust);
switch (domain) {
case LTTNG_DOMAIN_UST:
ust_registry_session_destroy(regp->reg.ust);
@@
-562,8
+565,7
@@
void buffer_reg_session_destroy(struct buffer_reg_session *regp,
}
/*
}
/*
- * Remove buffer registry UID object from the global hash table. RCU read side
- * lock MUST be acquired before calling this.
+ * Remove buffer registry UID object from the global hash table.
*/
void buffer_reg_uid_remove(struct buffer_reg_uid *regp)
{
*/
void buffer_reg_uid_remove(struct buffer_reg_uid *regp)
{
@@
-572,9
+574,11
@@
void buffer_reg_uid_remove(struct buffer_reg_uid *regp)
assert(regp);
assert(regp);
+ rcu_read_lock();
iter.iter.node = ®p->node.node;
ret = lttng_ht_del(buffer_registry_uid, &iter);
assert(!ret);
iter.iter.node = ®p->node.node;
ret = lttng_ht_del(buffer_registry_uid, &iter);
assert(!ret);
+ rcu_read_unlock();
}
static void rcu_free_buffer_reg_uid(struct rcu_head *head)
}
static void rcu_free_buffer_reg_uid(struct rcu_head *head)
@@
-620,11
+624,12
@@
void buffer_reg_uid_destroy(struct buffer_reg_uid *regp,
goto destroy;
}
goto destroy;
}
+ rcu_read_lock();
/* Get the right socket from the consumer object. */
socket = consumer_find_socket_by_bitness(regp->bits_per_long,
consumer);
if (!socket) {
/* Get the right socket from the consumer object. */
socket = consumer_find_socket_by_bitness(regp->bits_per_long,
consumer);
if (!socket) {
- goto
destroy
;
+ goto
unlock
;
}
switch (regp->domain) {
}
switch (regp->domain) {
@@
-637,9
+642,12
@@
void buffer_reg_uid_destroy(struct buffer_reg_uid *regp,
break;
default:
assert(0);
break;
default:
assert(0);
+ rcu_read_unlock();
return;
}
return;
}
+unlock:
+ rcu_read_unlock();
destroy:
call_rcu(®p->node.head, rcu_free_buffer_reg_uid);
}
destroy:
call_rcu(®p->node.head, rcu_free_buffer_reg_uid);
}
@@
-679,10
+687,12
@@
void buffer_reg_pid_destroy(struct buffer_reg_pid *regp)
/*
* Destroy per PID and UID registry hash table.
/*
* Destroy per PID and UID registry hash table.
+ *
+ * Should *NOT* be called with RCU read-side lock held.
*/
void buffer_reg_destroy_registries(void)
{
DBG3("Buffer registry destroy all registry");
*/
void buffer_reg_destroy_registries(void)
{
DBG3("Buffer registry destroy all registry");
-
lttng_ht_destroy
(buffer_registry_uid);
-
lttng_ht_destroy
(buffer_registry_pid);
+
ht_cleanup_push
(buffer_registry_uid);
+
ht_cleanup_push
(buffer_registry_pid);
}
}
This page took
0.027419 seconds
and
4
git commands to generate.