Fix: mark ltt_sessions_ht_destroy as static
[lttng-tools.git] / src / bin / lttng-sessiond / ust-app.c
index e3995bdf612d0e82a2fea38e0c4008fd4795b8f2..331a9d67160d4fee424e4ddb892e1f7057f8983b 100644 (file)
@@ -376,6 +376,8 @@ void delete_ust_app_channel_rcu(struct rcu_head *head)
  * Extract the lost packet or discarded events counter when the channel is
  * being deleted and store the value in the parent channel so we can
  * access it from lttng list and at stop/destroy.
+ *
+ * The session list lock must be held by the caller.
  */
 static
 void save_per_pid_lost_discarded_counters(struct ust_app_channel *ua_chan)
@@ -426,6 +428,8 @@ end:
 /*
  * Delete ust app channel safely. RCU read lock must be held before calling
  * this function.
+ *
+ * The session list lock must be held by the caller.
  */
 static
 void delete_ust_app_channel(int sock, struct ust_app_channel *ua_chan,
@@ -787,6 +791,8 @@ void delete_ust_app_session_rcu(struct rcu_head *head)
 /*
  * Delete ust app session safely. RCU read lock must be held before calling
  * this function.
+ *
+ * The session list lock must be held by the caller.
  */
 static
 void delete_ust_app_session(int sock, struct ust_app_session *ua_sess,
@@ -870,6 +876,11 @@ void delete_ust_app(struct ust_app *app)
        int ret, sock;
        struct ust_app_session *ua_sess, *tmp_ua_sess;
 
+       /*
+        * The session list lock must be held during this function to guarantee
+        * the existence of ua_sess.
+        */
+       session_lock_list();
        /* Delete ust app sessions info */
        sock = app->sock;
        app->sock = -1;
@@ -908,6 +919,7 @@ void delete_ust_app(struct ust_app *app)
 
        DBG2("UST app pid %d deleted", app->pid);
        free(app);
+       session_unlock_list();
 }
 
 /*
@@ -928,6 +940,8 @@ void delete_ust_app_rcu(struct rcu_head *head)
 /*
  * Delete the session from the application ht and delete the data structure by
  * freeing every object inside and releasing them.
+ *
+ * The session list lock must be held by the caller.
  */
 static void destroy_app_session(struct ust_app *app,
                struct ust_app_session *ua_sess)
@@ -5955,7 +5969,7 @@ int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
                }
 
                /* Get channel */
-               lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &uiter);
+               lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &uiter);
                ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
                /* If the session is found for the app, the channel must be there */
                assert(ua_chan_node);
@@ -5971,7 +5985,6 @@ int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
                                        ua_chan->key, consumer, discarded);
                        goto end;
                }
-               goto end;
        }
 
 end:
This page took 0.026108 seconds and 4 git commands to generate.