From: David Goulet Date: Wed, 3 Oct 2012 15:22:50 +0000 (-0400) Subject: Fix: Stream allocation and insertion consistency X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=e316aad5fbbe3782872083cb68dfdd58bccea811;hp=e316aad5fbbe3782872083cb68dfdd58bccea811;p=lttng-tools.git Fix: Stream allocation and insertion consistency This commit restores the consistency between the allocate and insertion operations on streams. The allocate stream function was changing the channel state by updating the refcount, cpucount and number of init stream. We now moved these operations into the add_stream function so that the initialization is done there and the del_stream handles the cleanup. So basically, any side effect done on a channel using a stream is now done in the add/del functions. The same was done for the metadata which is a special case that does not need to set the need update flag. Furthermore, the consumer_del_stream now can destroy a stream even if that stream was not successfully added to its hash table. The kernel and UST consumers now use it on error between allocation and the add_stream function. This refactoring fixes memory leaks, bad refcount values and file descriptor leaks. Also, the metadata destroy stream function was also fixed to use the waitfd_node which is also fixed in the consumer_del_metadata_stream that was deleting the wrong node pointer. The waitfd_node fixes were merged with this commit in order to make the whole patch works and not failed on make check. Acked-by: Mathieu Desnoyers Signed-off-by: David Goulet ---