Fix: Invalid parameter error reported when untracking PID
[lttng-tools.git] / src / bin / lttng-sessiond / trace-ust.c
index 9bc0b73d05cdb80363e159d76d703b102bd88141..9ec6e43b0baa8bae6c8d4602cd94743148787977 100644 (file)
@@ -788,7 +788,8 @@ int trace_ust_untrack_pid(struct ltt_ust_session *session, int pid)
                struct ust_app *app;
 
                if (!session->pid_tracker.ht) {
-                       retval = LTTNG_ERR_INVALID;
+                       /* No PID being tracked. */
+                       retval = LTTNG_ERR_PID_NOT_TRACKED;
                        goto end;
                }
                /* Remove PID from tracker */
@@ -952,11 +953,6 @@ static void _trace_ust_destroy_channel(struct ltt_ust_channel *channel)
 
        DBG2("Trace destroy UST channel %s", channel->name);
 
-       /* Destroying all events of the channel */
-       destroy_events(channel->events);
-       /* Destroying all context of the channel */
-       destroy_contexts(channel->ctx);
-
        free(channel);
 }
 
@@ -975,6 +971,11 @@ static void destroy_channel_rcu(struct rcu_head *head)
 
 void trace_ust_destroy_channel(struct ltt_ust_channel *channel)
 {
+       /* Destroying all events of the channel */
+       destroy_events(channel->events);
+       /* Destroying all context of the channel */
+       destroy_contexts(channel->ctx);
+
        call_rcu(&channel->node.head, destroy_channel_rcu);
 }
 
@@ -1000,18 +1001,18 @@ void trace_ust_delete_channel(struct lttng_ht *ht,
  */
 static void destroy_channels(struct lttng_ht *channels)
 {
-       int ret;
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
 
        assert(channels);
 
        rcu_read_lock();
-
        cds_lfht_for_each_entry(channels->ht, &iter.iter, node, node) {
-               ret = lttng_ht_del(channels, &iter);
-               assert(!ret);
-               call_rcu(&node->head, destroy_channel_rcu);
+               struct ltt_ust_channel *chan =
+                       caa_container_of(node, struct ltt_ust_channel, node);
+
+               trace_ust_delete_channel(channels, chan);
+               trace_ust_destroy_channel(chan);
        }
        rcu_read_unlock();
 
This page took 0.023584 seconds and 4 git commands to generate.