X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fconsumer.c;h=dc21e24ca0a5c01e4c2e8d3b24082492685944bf;hb=366a9222abc182bf77de1b806256aa9a9dc8832a;hp=5e723e9b3804e08335d3e16758486899ec79f83e;hpb=43fade62cebf3c70b79e48e1ad9afbb9ab6e48f3;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 5e723e9b3..dc21e24ca 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -731,6 +731,8 @@ error: /* * Send file descriptor to consumer via sock. + * + * The consumer socket lock must be held by the caller. */ int consumer_send_fds(struct consumer_socket *sock, int *fds, size_t nb_fd) { @@ -755,6 +757,8 @@ error: /* * Consumer send communication message structure to consumer. + * + * The consumer socket lock must be held by the caller. */ int consumer_send_msg(struct consumer_socket *sock, struct lttcomm_consumer_msg *msg) @@ -778,6 +782,8 @@ error: /* * Consumer send channel communication message structure to consumer. + * + * The consumer socket lock must be held by the caller. */ int consumer_send_channel(struct consumer_socket *sock, struct lttcomm_consumer_msg *msg) @@ -1068,6 +1074,7 @@ int consumer_send_channel_monitor_pipe(struct consumer_socket *consumer_sock, memset(&msg, 0, sizeof(msg)); msg.cmd_type = LTTNG_CONSUMER_SET_CHANNEL_MONITOR_PIPE; + pthread_mutex_lock(consumer_sock->lock); DBG3("Sending set_channel_monitor_pipe command to consumer"); ret = consumer_send_msg(consumer_sock, &msg); if (ret < 0) { @@ -1083,6 +1090,7 @@ int consumer_send_channel_monitor_pipe(struct consumer_socket *consumer_sock, DBG2("Channel monitoring pipe successfully sent"); error: + pthread_mutex_unlock(consumer_sock->lock); return ret; } @@ -1419,7 +1427,7 @@ int consumer_snapshot_channel(struct consumer_socket *socket, uint64_t key, } else { ret = snprintf(msg.u.snapshot_channel.pathname, sizeof(msg.u.snapshot_channel.pathname), - "%s/%s-%s-%" PRIu64 "%s", output->consumer->dst.trace_path, + "%s/%s-%s-%" PRIu64 "%s", output->consumer->dst.session_root_path, output->name, output->datetime, output->nb_snapshot, session_path); if (ret < 0) { @@ -1440,7 +1448,9 @@ int consumer_snapshot_channel(struct consumer_socket *socket, uint64_t key, } health_code_update(); + pthread_mutex_lock(socket->lock); ret = consumer_send_msg(socket, &msg); + pthread_mutex_unlock(socket->lock); if (ret < 0) { goto error; }