lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
From: Mikael Beckius via lttng-dev <lttng-dev@lists.lttng.org>
To: lttng-dev@lists.lttng.org
Subject: [lttng-dev] [PATCH lttng-tools] Fix: sessiond: Consolidate key hash generation
Date: Thu, 11 May 2023 21:55:51 +0200	[thread overview]
Message-ID: <20230511195551.67606-1-mikael.beckius@windriver.com> (raw)

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@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

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

                 reply	other threads:[~2023-05-11 20:50 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=20230511195551.67606-1-mikael.beckius@windriver.com \
    --to=lttng-dev@lists.lttng.org \
    --cc=mikael.beckius@windriver.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;
as well as URLs for NNTP newsgroup(s).