X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lttng-sessiond%2Fust-app.c;h=99fd84f3e07ca5982875ab257dd7f2146d9c225f;hb=3a009adbd8bf5305668e7e41e5e9f12813d04959;hp=e063fb292ad80511f45331896704bba555898d14;hpb=dbdbd482ead909120dc3c4e4b6e41413b7fa57a1;p=lttng-tools.git diff --git a/lttng-sessiond/ust-app.c b/lttng-sessiond/ust-app.c index e063fb292..99fd84f3e 100644 --- a/lttng-sessiond/ust-app.c +++ b/lttng-sessiond/ust-app.c @@ -113,7 +113,6 @@ static struct ust_app *find_app_by_sock(int sock) (void *)((unsigned long) sock), sizeof(void *), &iter); if (node == NULL) { DBG2("UST app find by sock %d key not found", sock); - rcu_read_unlock(); goto error; } @@ -123,7 +122,6 @@ static struct ust_app *find_app_by_sock(int sock) (void *)((unsigned long) key->pid), sizeof(void *), &iter); if (node == NULL) { DBG2("UST app find by sock %d not found", sock); - rcu_read_unlock(); goto error; } @@ -153,7 +151,6 @@ struct ust_app *ust_app_find_by_pid(pid_t pid) node = hashtable_lookup(ust_app_ht, (void *)((unsigned long) pid), sizeof(void *), &iter); if (node == NULL) { - rcu_read_unlock(); DBG2("UST app no found with pid %d", pid); goto error; } @@ -164,6 +161,7 @@ struct ust_app *ust_app_find_by_pid(pid_t pid) return caa_container_of(node, struct ust_app, node); error: + rcu_read_unlock(); return NULL; } @@ -808,7 +806,7 @@ int ust_app_add_channel_all(struct ltt_ust_session *usess, /* Create session on the tracer side and add it to app session HT */ ua_sess = create_ust_app_session(usess, app); - if (ret < 0) { + if (ua_sess == NULL) { goto next; } @@ -851,7 +849,7 @@ int ust_app_add_event_all(struct ltt_ust_session *usess, /* Create session on the tracer side and add it to app session HT */ ua_sess = create_ust_app_session(usess, app); - if (ret < 0) { + if (ua_sess == NULL) { goto next; } @@ -889,15 +887,17 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app) DBG("Starting tracing for ust app pid %d", app->key.pid); + rcu_read_lock(); + ua_sess = lookup_session_by_app(usess, app); if (ua_sess == NULL) { /* Only malloc can failed so something is really wrong */ - goto error; + goto error_rcu_unlock; } ret = create_ust_app_metadata(ua_sess, usess->pathname, app); if (ret < 0) { - goto error; + goto error_rcu_unlock; } /* For each channel */ @@ -912,7 +912,7 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app) ustream = zmalloc(sizeof(*ustream)); if (ustream == NULL) { PERROR("zmalloc ust stream"); - continue; + goto error_rcu_unlock; } ret = ustctl_create_stream(app->key.sock, ua_chan->obj, @@ -943,22 +943,24 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app) /* Setup UST consumer socket and send fds to it */ ret = ust_consumer_send_session(usess->consumer_fd, ua_sess); if (ret < 0) { - goto error; + goto error_rcu_unlock; } /* This start the UST tracing */ ret = ustctl_start_session(app->key.sock, ua_sess->handle); if (ret < 0) { ERR("Error starting tracing for app pid: %d", app->key.pid); - goto error; + goto error_rcu_unlock; } + rcu_read_unlock(); /* Quiescent wait after starting trace */ ustctl_wait_quiescent(app->key.sock); return 0; -error: +error_rcu_unlock: + rcu_read_unlock(); return -1; }