* Returns 0 on success or else a negative code which is either -ENOMEM or
* -ENOTCONN which is the default code if the ustctl_create_session fails.
*/
-static int create_ust_app_session(struct ltt_ust_session *usess,
+static int find_or_create_ust_app_session(struct ltt_ust_session *usess,
struct ust_app *app, struct ust_app_session **ua_sess_ptr,
int *is_created)
{
* Create and send to the application the created buffers with per UID buffers.
*
* This MUST be called with a RCU read side lock acquired.
+ * The session list lock and the session's lock must be acquired.
*
* Return 0 on success else a negative value.
*/
session = session_find_by_id(ua_sess->tracing_id);
assert(session);
+ assert(pthread_mutex_trylock(&session->lock));
+ assert(session_trylock_list());
cmd_ret = notification_thread_command_add_channel(
notification_thread_handle, session->name,
ua_sess->euid, ua_sess->egid,
* Create and send to the application the created buffers with per PID buffers.
*
* Called with UST app session lock held.
+ * The session list lock and the session's lock must be acquired.
*
* Return 0 on success else a negative value.
*/
chan_reg->consumer_key = ua_chan->key;
pthread_mutex_unlock(®istry->lock);
+ assert(pthread_mutex_trylock(&session->lock));
+ assert(session_trylock_list());
+
cmd_ret = notification_thread_command_add_channel(
notification_thread_handle, session->name,
ua_sess->euid, ua_sess->egid,
* that if session exist, it will simply return a pointer to the ust
* app session.
*/
- ret = create_ust_app_session(usess, app, &ua_sess, &created);
+ ret = find_or_create_ust_app_session(usess, app, &ua_sess, &created);
if (ret < 0) {
switch (ret) {
case -ENOTCONN:
struct ust_app_ctx *ua_ctx;
int is_created = 0;
- ret = create_ust_app_session(usess, app, &ua_sess, &is_created);
+ ret = find_or_create_ust_app_session(usess, app, &ua_sess, &is_created);
if (ret < 0) {
/* Tracer is probably gone or ENOMEM. */
goto error;