#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
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:
/*
* 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;
assert(!ret);
buffer_reg_channel_destroy(reg_chan, domain);
}
- lttng_ht_destroy(regp->channels);
rcu_read_unlock();
+ ht_cleanup_push(regp->channels);
+
switch (domain) {
case LTTNG_DOMAIN_UST:
ust_registry_session_destroy(regp->reg.ust);
}
/*
- * 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)
{
assert(regp);
+ rcu_read_lock();
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)
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) {
- goto destroy;
+ goto unlock;
}
switch (regp->domain) {
break;
default:
assert(0);
+ rcu_read_unlock();
return;
}
+unlock:
+ rcu_read_unlock();
destroy:
call_rcu(®p->node.head, rcu_free_buffer_reg_uid);
}
/*
* 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");
- lttng_ht_destroy(buffer_registry_uid);
- lttng_ht_destroy(buffer_registry_pid);
+ ht_cleanup_push(buffer_registry_uid);
+ ht_cleanup_push(buffer_registry_pid);
}