From: Francis Deslauriers Date: Tue, 8 Jun 2021 20:14:49 +0000 (-0400) Subject: Cleanup: ust-app: simplify ust_app_synchronize() error paths X-Git-Tag: v2.13.0-rc3~51 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=1549157ca88450d63f8fe55bd527b311e782d3ab;p=lttng-tools.git Cleanup: ust-app: simplify ust_app_synchronize() error paths Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau Change-Id: I7fd3636dfb1370ebe224aa2e200189b2fe99002a --- 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; }