[lttng-dev] [PATCH lttng-tools] Fix: sessiond: Consolidate key hash generation
Mikael Beckius
mikael.beckius at windriver.com
Thu May 11 15:55:51 EDT 2023
add_unique_ust_app_event will create the same key hash
for both --loglevel and --loglevel-only, resulting in:
add_unique_ust_app_event: Assertion `node_ptr == &event->node.node' failed.
Signed-off-by: Mikael Beckius <mikael.beckius at windriver.com>
---
src/bin/lttng-sessiond/ust-app.cpp | 16 +++++++++++-----
src/bin/lttng-sessiond/ust-app.hpp | 7 -------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/bin/lttng-sessiond/ust-app.cpp b/src/bin/lttng-sessiond/ust-app.cpp
index b9091424b..f34b17d05 100644
--- a/src/bin/lttng-sessiond/ust-app.cpp
+++ b/src/bin/lttng-sessiond/ust-app.cpp
@@ -179,7 +179,7 @@ static void copy_channel_attr_to_ustctl(struct lttng_ust_ctl_consumer_channel_at
static int ht_match_ust_app_event(struct cds_lfht_node *node, const void *_key)
{
struct ust_app_event *event;
- const struct ust_app_ht_key *key;
+ const struct ltt_ust_ht_key *key;
int ev_loglevel_value;
LTTNG_ASSERT(node);
@@ -253,7 +253,7 @@ no_match:
static void add_unique_ust_app_event(struct ust_app_channel *ua_chan, struct ust_app_event *event)
{
struct cds_lfht_node *node_ptr;
- struct ust_app_ht_key key;
+ struct ltt_ust_ht_key key;
struct lttng_ht *ht;
LTTNG_ASSERT(ua_chan);
@@ -263,7 +263,8 @@ static void add_unique_ust_app_event(struct ust_app_channel *ua_chan, struct ust
ht = ua_chan->events;
key.name = event->attr.name;
key.filter = event->filter;
- key.loglevel_type = (lttng_ust_abi_loglevel_type) event->attr.loglevel;
+ key.loglevel_type = event->attr.loglevel_type;
+ key.loglevel_value = event->attr.loglevel;
key.exclusion = event->exclusion;
node_ptr = cds_lfht_add_unique(ht->ht,
@@ -1499,13 +1500,14 @@ error:
static struct ust_app_event *find_ust_app_event(struct lttng_ht *ht,
const char *name,
const struct lttng_bytecode *filter,
+ enum lttng_ust_abi_loglevel_type loglevel_type,
int loglevel_value,
const struct lttng_event_exclusion *exclusion)
{
struct lttng_ht_iter iter;
struct lttng_ht_node_str *node;
struct ust_app_event *event = nullptr;
- struct ust_app_ht_key key;
+ struct ltt_ust_ht_key key;
LTTNG_ASSERT(name);
LTTNG_ASSERT(ht);
@@ -1513,7 +1515,8 @@ static struct ust_app_event *find_ust_app_event(struct lttng_ht *ht,
/* Setup key for event lookup. */
key.name = name;
key.filter = filter;
- key.loglevel_type = (lttng_ust_abi_loglevel_type) loglevel_value;
+ key.loglevel_type = loglevel_type;
+ key.loglevel_value = loglevel_value;
/* lttng_event_exclusion and lttng_ust_event_exclusion structures are similar */
key.exclusion = exclusion;
@@ -5004,6 +5007,7 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
ua_event = find_ust_app_event(ua_chan->events,
uevent->attr.name,
uevent->filter,
+ uevent->attr.loglevel_type,
uevent->attr.loglevel,
uevent->exclusion);
if (ua_event == nullptr) {
@@ -5167,6 +5171,7 @@ int ust_app_enable_event_glb(struct ltt_ust_session *usess,
ua_event = find_ust_app_event(ua_chan->events,
uevent->attr.name,
uevent->filter,
+ uevent->attr.loglevel_type,
uevent->attr.loglevel,
uevent->exclusion);
if (ua_event == nullptr) {
@@ -5952,6 +5957,7 @@ static int ust_app_channel_synchronize_event(struct ust_app_channel *ua_chan,
ua_event = find_ust_app_event(ua_chan->events,
uevent->attr.name,
uevent->filter,
+ uuevent->attr.loglevel_type,
uevent->attr.loglevel,
uevent->exclusion);
if (!ua_event) {
diff --git a/src/bin/lttng-sessiond/ust-app.hpp b/src/bin/lttng-sessiond/ust-app.hpp
index fdc007853..7781984ff 100644
--- a/src/bin/lttng-sessiond/ust-app.hpp
+++ b/src/bin/lttng-sessiond/ust-app.hpp
@@ -41,13 +41,6 @@ struct ust_app_notify_sock_obj {
struct rcu_head head;
};
-struct ust_app_ht_key {
- const char *name;
- const struct lttng_bytecode *filter;
- enum lttng_ust_abi_loglevel_type loglevel_type;
- const struct lttng_event_exclusion *exclusion;
-};
-
/*
* Application registration data structure.
*/
--
2.34.1
More information about the lttng-dev
mailing list