X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-app.c;h=c902b21768bb3c6dd2e4e059cc6e76b52be84bcd;hb=ec4723516f5a1375c4639447225965f8735aadd3;hp=a1c681143c90be4afb71390270fb608dcef564e7;hpb=cbdbc8fa8f0ac6eddaa767c891f6d88a62cac001;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index a1c681143..c902b2176 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -3013,7 +3013,7 @@ static int duplicate_stream_object(struct buffer_reg_stream *reg_stream, assert(reg_stream); assert(stream); - /* Reserve the amount of file descriptor we need. */ + /* Duplicating a stream requires 2 new fds. Reserve them. */ ret = lttng_fd_get(LTTNG_FD_APPS, 2); if (ret < 0) { ERR("Exhausted number of available FD upon duplicate stream"); @@ -3049,7 +3049,7 @@ static int duplicate_channel_object(struct buffer_reg_channel *buf_reg_chan, assert(buf_reg_chan); assert(ua_chan); - /* Need two fds for the channel. */ + /* Duplicating a channel requires 1 new fd. Reserve it. */ ret = lttng_fd_get(LTTNG_FD_APPS, 1); if (ret < 0) { ERR("Exhausted number of available FD upon duplicate channel"); @@ -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: +deleted_session: pthread_mutex_unlock(&ua_sess->lock); - /* Everything went well at this point. */ - return; - -error_unlock: - rcu_read_unlock(); - pthread_mutex_unlock(&ua_sess->lock); -error: - if (ua_sess) { - destroy_app_session(app, ua_sess); - } +end: return; }