From: Mathieu Desnoyers Date: Thu, 11 May 2017 20:00:56 +0000 (-0400) Subject: Fix: lttng-consumerd: cpu hotplug: send "streams_sent" command X-Git-Tag: v2.8.7~6 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7881b1c495675c9b0f9df93fbaeff6cf49310f2a;p=lttng-tools.git Fix: lttng-consumerd: cpu hotplug: send "streams_sent" command When creating a new channel, the streams being sent to the relayd are kept invisible to the live client until the "streams_sent" command is received. This ensures the client does not see a partial stream set. This "streams_sent" command needs to be sent on CPU hotplug too, otherwise the live client handling within relayd is not aware of those streams (they are never published). Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/consumer/consumer.h b/src/common/consumer/consumer.h index 37adecbfe..66092d3c5 100644 --- a/src/common/consumer/consumer.h +++ b/src/common/consumer/consumer.h @@ -218,6 +218,8 @@ struct lttng_consumer_channel { uint64_t discarded_events; /* Total number of missed packets due to overwriting (overwrite). */ uint64_t lost_packets; + + bool streams_sent_to_relayd; }; /* diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index 007eef8fc..d9c4d2685 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -185,6 +185,7 @@ int lttng_kconsumer_snapshot_channel(uint64_t key, char *path, ERR("sending streams sent to relayd"); goto end_unlock; } + channel->streams_sent_to_relayd = true; } ret = kernctl_buffer_flush(stream->wait_fd); @@ -726,6 +727,19 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, consumer_stream_free(new_stream); goto end_nosignal; } + + /* + * If adding an extra stream to an already + * existing channel (e.g. cpu hotplug), we need + * to send the "streams_sent" command to relayd. + */ + if (channel->streams_sent_to_relayd) { + ret = consumer_send_relayd_streams_sent( + new_stream->net_seq_idx); + if (ret < 0) { + goto end_nosignal; + } + } } /* Get the right pipe where the stream will be sent. */ @@ -819,6 +833,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, if (ret < 0) { goto end_nosignal; } + channel->streams_sent_to_relayd = true; } break; }