X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-app.c;h=0db0eb17382077d34fd95e0790acba624047ad98;hb=61ba6b6dc790245afa7fbec89a9811f6c7603b00;hp=675283aa63477b3679aa27a7f8942d1c52453dae;hpb=9acdc1d6905e2bf2c814d303b152e56525745710;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 675283aa6..0db0eb173 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -2925,7 +2925,6 @@ static int create_channel_per_uid(struct ust_app *app, uint64_t chan_reg_key; struct ust_registry_channel *chan_reg; - rcu_read_lock(); chan_reg_key = ua_chan->tracing_channel_id; pthread_mutex_lock(®_uid->registry->reg.ust->lock); @@ -2946,7 +2945,6 @@ static int create_channel_per_uid(struct ust_app *app, ua_chan->key, LTTNG_DOMAIN_UST, ua_chan->attr.subbuf_size * ua_chan->attr.num_subbuf); - rcu_read_unlock(); if (cmd_ret != LTTNG_OK) { ret = - (int) cmd_ret; ERR("Failed to add channel to notification thread"); @@ -3579,8 +3577,8 @@ void ust_app_unregister(int sock) /* * Remove application from notify hash table. The thread handling the * notify socket could have deleted the node so ignore on error because - * either way it's valid. The close of that socket is handled by the other - * thread. + * either way it's valid. The close of that socket is handled by the + * apps_notify_thread. */ iter.iter.node = <a->notify_sock_n.node; (void) lttng_ht_del(ust_app_ht_by_notify_sock, &iter); @@ -4419,9 +4417,32 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app) /* Create directories if consumer is LOCAL and has a path defined. */ if (usess->consumer->type == CONSUMER_DST_LOCAL && - strlen(usess->consumer->dst.trace_path) > 0) { - ret = run_as_mkdir_recursive(usess->consumer->dst.trace_path, - S_IRWXU | S_IRWXG, ua_sess->euid, ua_sess->egid); + usess->consumer->dst.session_root_path[0] != '\0') { + char *tmp_path; + + tmp_path = zmalloc(LTTNG_PATH_MAX); + if (!tmp_path) { + ERR("Alloc tmp_path"); + goto error_unlock; + } + ret = snprintf(tmp_path, LTTNG_PATH_MAX, "%s%s%s", + usess->consumer->dst.session_root_path, + usess->consumer->chunk_path, + usess->consumer->subdir); + if (ret >= LTTNG_PATH_MAX) { + ERR("Local destination path exceeds the maximal allowed length of %i bytes (needs %i bytes) with path = \"%s%s%s\"", + LTTNG_PATH_MAX, ret, + usess->consumer->dst.session_root_path, + usess->consumer->chunk_path, + usess->consumer->subdir); + goto error_unlock; + } + + DBG("Creating directory path for local tracing: \"%s\"", + tmp_path); + ret = run_as_mkdir_recursive(tmp_path, S_IRWXU | S_IRWXG, + ua_sess->euid, ua_sess->egid); + free(tmp_path); if (ret < 0) { if (errno != EEXIST) { ERR("Trace directory creation error");