projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: check validity of a stream before invoking ust flush command
[lttng-tools.git]
/
src
/
common
/
ust-consumer
/
ust-consumer.c
diff --git
a/src/common/ust-consumer/ust-consumer.c
b/src/common/ust-consumer/ust-consumer.c
index 5b8e9431f9ca15d2dbba787442863650fe343453..88b687611fc8714675722f8616a85b10fce40baa 100644
(file)
--- a/
src/common/ust-consumer/ust-consumer.c
+++ b/
src/common/ust-consumer/ust-consumer.c
@@
-768,10
+768,19
@@
static int flush_channel(uint64_t chan_key)
health_code_update();
pthread_mutex_lock(&stream->lock);
health_code_update();
pthread_mutex_lock(&stream->lock);
+
+ /*
+ * Protect against concurrent teardown of a stream.
+ */
+ if (cds_lfht_is_node_deleted(&stream->node.node)) {
+ goto next;
+ }
+
if (!stream->quiescent) {
ustctl_flush_buffer(stream->ustream, 0);
stream->quiescent = true;
}
if (!stream->quiescent) {
ustctl_flush_buffer(stream->ustream, 0);
stream->quiescent = true;
}
+next:
pthread_mutex_unlock(&stream->lock);
}
error:
pthread_mutex_unlock(&stream->lock);
}
error:
@@
-1174,7
+1183,7
@@
static int snapshot_channel(uint64_t key, char *path, uint64_t relayd_id,
produced_pos, nb_packets_per_stream,
stream->max_sb_size);
produced_pos, nb_packets_per_stream,
stream->max_sb_size);
- while (
consumed_pos < produced_pos
) {
+ while (
(long) (consumed_pos - produced_pos) < 0
) {
ssize_t read_len;
unsigned long len, padded_len;
ssize_t read_len;
unsigned long len, padded_len;
@@
-2922,7
+2931,7
@@
int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
request.key = channel->key;
DBG("Sending metadata request to sessiond, session id %" PRIu64
request.key = channel->key;
DBG("Sending metadata request to sessiond, session id %" PRIu64
- ", per-pid %" PRIu64 ", app UID %u and channe
k
key %" PRIu64,
+ ", per-pid %" PRIu64 ", app UID %u and channe
l
key %" PRIu64,
request.session_id, request.session_id_per_pid, request.uid,
request.key);
request.session_id, request.session_id_per_pid, request.uid,
request.key);
This page took
0.030338 seconds
and
4
git commands to generate.