Fix: Stream allocation and insertion consistency
authorDavid Goulet <dgoulet@efficios.com>
Wed, 3 Oct 2012 15:22:50 +0000 (11:22 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 9 Oct 2012 15:20:49 +0000 (11:20 -0400)
commite316aad5fbbe3782872083cb68dfdd58bccea811
tree18f8d5b2629db39311faeff962b46d5073ee26fd
parent5ab7344e564fad002de7efc879ffbed5bd23d5ef
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 <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/consumer.c
src/common/consumer.h
src/common/kernel-consumer/kernel-consumer.c
src/common/ust-consumer/ust-consumer.c
src/common/ust-consumer/ust-consumer.h
This page took 0.027846 seconds and 5 git commands to generate.