Fix: skip metadata flushed check if write failed

On a metadata cache write failure, we now skip the metadata flushed
check or else an infinite loop could have been possible.

Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: set metadata closed on a push/close metadata error

Check the metadata closed flag before pushing and closing the metadata
on the consumer side. On any error from those two actions, the closed
flag is set to indicate to stop using the metadata registry until a
destroy is done.

Also, before creating a metadata, a check is done to see if the registry
metadata was closed previously or else a new metadata key is created and
the old values from the previous channel in the registry are used
causing a bad state on the consumer.

With per UID buffers, the metadata cache is shared accross multiple
applications so if the metadata buffers were deleted on the consumer for
whatever reasons, we must STOP using it or else undesired behaviors have
been observed such as causing synchronization issues between the state
of the consumer and sessiond.

A destroy session command will wipe the faulty metadata.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: add more conditions and a lock to metadata cache flushed

Some more conditions applies to return if the metadata cache is indeed
flushed. If no metadata stream is found or the endpoint status is set to
something other than ACTIVE, this means the channel is being (or will
be) destroyed thus the metadata cache can't be updated so is indeed
"flushed".

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Revert "Improve channel listing output format"

This changed the text output *after* rc1. We'll keep this in the back
burner for 2.3.

This reverts commit e78de861055e6288d11348866681d1373ed81aec.
Fix: Missing RCU locks on access to consumerd's channel ht

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: add missing ht iter node assignment in channel thread

Fixes #547

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: remove nonblock flag of sessiond socket in consumer

There is no need for non blocking socket. Furthermore, we have observed
unstable behaviors with a non blocking side (consumer) and a blocking
side (sessiond).

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: poll compat layer reallocation new size

The size was doubled but in fact it should have been checked for the
maximum between the number of fd doubled and the alloc size doubled
(divised by two when shrinking the buffer).

Same goes for the shrink process. For that, get_count_order_u32() is
added to utils.c/.h.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix ua_chan assert

delete_ust_app() can remove a channel objd from the hash table
concurrently with notify

Fix #560

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: hash table cleanup call_rcu deadlock

Implement hash table cleanup thread so HT cleanup never deadlocks on
resize in progress.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Implement health check for app notification thread

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Implement health check for app registration dispatch

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: sanitize wait queue in the dispatch thread

This is to avoid memory leaks when the notify socket is never received
thus cleaning the wait node for command socket that are invalid.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: memleaks in channel/event notify

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: add missing free causing a memleak

Also remove a unused variable in the ust registry event structure.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: memleak in the UST registry

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: memleak in liblttng-ctl visit_node_load()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: Remove reference to lttng-probe-lttng kernel module

The lttng-probe-lttng module was removed as part of lttng-modules
commit 662ed1665428b38ee00d4be5751581108bf35390

Fixes #553

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: comparing array against NULL

1019939 Array compared against 0
In process_client_msg: Array compared against NULL pointer (CWE-398)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: unnecessarily large memory allocation

1019911 Wrong sizeof argument
In consumer_thread_data_poll: The sizeof operator is invoked on the
wrong argument (CWE-569)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>