sessiond: Replace uses of session_trylock_list by a dedicated assert macro
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 5 May 2022 19:00:10 +0000 (15:00 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 13 Jun 2022 20:34:46 +0000 (16:34 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I925a2f4052149b3a9ff91a80c7541dc8ed226c70

src/bin/lttng-sessiond/kernel-consumer.cpp
src/bin/lttng-sessiond/session.hpp
src/bin/lttng-sessiond/ust-app.cpp

index 844f535416a80ee02dd055083e3555964b29b9f1..ece50de117456feddd7d653c27a8693283dbd919 100644 (file)
@@ -169,8 +169,8 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
        rcu_read_lock();
        session = session_find_by_id(ksession->id);
        LTTNG_ASSERT(session);
-       LTTNG_ASSERT(pthread_mutex_trylock(&session->lock));
-       LTTNG_ASSERT(session_trylock_list());
+       ASSERT_LOCKED(session->lock);
+       ASSERT_SESSION_LIST_LOCKED();
 
        status = notification_thread_command_add_channel(
                        the_notification_thread_handle, session->name,
index 0fad8132cc9661b6af65bd4bf4b3562ff5090fc7..ad451336a5b5b430ad49a9d8e99c3bdb26a07429 100644 (file)
@@ -22,6 +22,8 @@
 #include "trace-kernel.hpp"
 #include "consumer.hpp"
 
+#define ASSERT_SESSION_LIST_LOCKED() LTTNG_ASSERT(session_trylock_list())
+
 struct ltt_ust_session;
 
 typedef void (*ltt_session_destroy_notifier)(const struct ltt_session *session,
index fcc4267ad5ea8360ae6e139bada338f6f1dff83e..2fc3b6f4f120793dd280e78d8d170113ca04e9d7 100644 (file)
@@ -3411,8 +3411,8 @@ static int create_channel_per_uid(struct ust_app *app,
 
        session = session_find_by_id(ua_sess->tracing_id);
        LTTNG_ASSERT(session);
-       LTTNG_ASSERT(pthread_mutex_trylock(&session->lock));
-       LTTNG_ASSERT(session_trylock_list());
+       ASSERT_LOCKED(session->lock);
+       ASSERT_SESSION_LIST_LOCKED();
 
        /*
         * Create the buffers on the consumer side. This call populates the
@@ -3527,9 +3527,8 @@ static int create_channel_per_pid(struct ust_app *app,
 
        session = session_find_by_id(ua_sess->tracing_id);
        LTTNG_ASSERT(session);
-
-       LTTNG_ASSERT(pthread_mutex_trylock(&session->lock));
-       LTTNG_ASSERT(session_trylock_list());
+       ASSERT_LOCKED(session->lock);
+       ASSERT_SESSION_LIST_LOCKED();
 
        /* Create and get channel on the consumer side. */
        ret = do_consumer_create_channel(usess, ua_sess, ua_chan,
@@ -3874,9 +3873,8 @@ static int create_ust_app_metadata(struct ust_app_session *ua_sess,
 
        session = session_find_by_id(ua_sess->tracing_id);
        LTTNG_ASSERT(session);
-
-       LTTNG_ASSERT(pthread_mutex_trylock(&session->lock));
-       LTTNG_ASSERT(session_trylock_list());
+       ASSERT_LOCKED(session->lock);
+       ASSERT_SESSION_LIST_LOCKED();
 
        /*
         * Ask the metadata channel creation to the consumer. The metadata object
This page took 0.028956 seconds and 4 git commands to generate.