Fix: race with index file creation

Only the data thread should create the index file since it is
responsible of filling the FD field of the index struct in memory.
When the control thread is ready to write the index, the FD is already
set.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
fix: return RETRY if the index is not ready

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Fix: handle the case where the index is not yet ready

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Fix: deadlock during rotation

The overwrite_lock is nested inside the viewer_stream_rotation_lock.
And the viewer_stream_rotate function is always called with the
viewer_stream_rotation_lock held.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>