From 1549157ca88450d63f8fe55bd527b311e782d3ab Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Tue, 8 Jun 2021 16:14:49 -0400 Subject: [PATCH] Cleanup: ust-app: simplify ust_app_synchronize() error paths MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau Change-Id: I7fd3636dfb1370ebe224aa2e200189b2fe99002a --- src/bin/lttng-sessiond/ust-app.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index a1c681143..4f136550c 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -5903,13 +5903,16 @@ void ust_app_synchronize(struct ltt_ust_session *usess, ret = find_or_create_ust_app_session(usess, app, &ua_sess, NULL); if (ret < 0) { /* Tracer is probably gone or ENOMEM. */ - goto error; + if (ua_sess) { + destroy_app_session(app, ua_sess); + } + goto end; } assert(ua_sess); pthread_mutex_lock(&ua_sess->lock); if (ua_sess->deleted) { - goto end; + goto deleted_session; } rcu_read_lock(); @@ -5927,23 +5930,15 @@ void ust_app_synchronize(struct ltt_ust_session *usess, */ ret = create_ust_app_metadata(ua_sess, app, usess->consumer); if (ret < 0) { - goto error_unlock; + ERR("Metadata creation failed for app sock %d for session id %" PRIu64, + app->sock, usess->id); } rcu_read_unlock(); -end: - pthread_mutex_unlock(&ua_sess->lock); - /* Everything went well at this point. */ - return; - -error_unlock: - rcu_read_unlock(); +deleted_session: pthread_mutex_unlock(&ua_sess->lock); -error: - if (ua_sess) { - destroy_app_session(app, ua_sess); - } +end: return; } -- 2.34.1