Fix: sessiond: agent: lazy creation of agent on removal
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 24 Mar 2021 18:21:40 +0000 (14:21 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 24 Mar 2021 18:27:39 +0000 (14:27 -0400)
When unregistering a trigger that was previously registered, the
agent corresponding to the trigger's domain will already exist. It is
superfluous to handle the case where it doesn't exist and it would only
hide an internal error.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ifc6d14b74586af8423a70b3466e0a2c00491d3c3

src/bin/lttng-sessiond/cmd.c

index e8fd3110e21c2cacb8fe8bd07c2cac5c26f6a9ee..90a011fd9ad72a0f44efe2418d1706842e796dff 100644 (file)
@@ -4513,16 +4513,11 @@ enum lttng_error_code synchronize_tracer_notifier_unregister(
                struct agent *agt = agent_find_by_event_notifier_domain(
                                trigger_domain);
 
-               if (!agt) {
-                       agt = agent_create(trigger_domain);
-                       if (!agt) {
-                               ret_code = LTTNG_ERR_NOMEM;
-                               goto end_unlock_session_list;
-                       }
-
-                       agent_add(agt, trigger_agents_ht_by_domain);
-               }
-
+               /*
+                * This trigger was never registered in the first place. Calling
+                * this function under those circumstances is an internal error.
+                */
+               assert(agt);
                ret_code = trigger_agent_disable(trigger, agt);
                if (ret_code != LTTNG_OK) {
                        goto end_unlock_session_list;
This page took 0.035032 seconds and 4 git commands to generate.