Logging: Fix breakage when freeing the log ringbuffer
authorMartin Schwenke <martin@meltin.net>
Fri, 19 Apr 2013 04:35:49 +0000 (14:35 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Fri, 19 Apr 2013 06:27:08 +0000 (16:27 +1000)
commit764359b2081b7b6aad6af17e9b86b7df0e422416
treeb3ee11a35026585a6aabf75a27dae2a29cd5de39
parent64bbe9f35f58b5f2af23acfa6ded9751839b9ece
Logging: Fix breakage when freeing the log ringbuffer

Commit c6e1b84595039edb5c49a5851b440710dc0e2ac1 broke fetching from
the log ringbuffer.  The solution there is still generally good: there
is no need to keep the ringbuffer in children created by
ctdb_fork()... except for those special children that are created to
fetch data from the ringbuffer!

Introduce a new function ctdb_fork_no_free_ringbuffer() that does
everything ctdb_fork() needs to do except free the ringbuffer (i.e. it
is the old ctdb_fork() function).  The new ctdb_fork() function just
calls that function and then frees the ringbuffer in the child.

This means all callers of ctdb_fork() have the convenience of having
the ringbuffer freed, apart from the special case in the ringbuffer
fetching code where we call ctdb_fork_no_free_ringbuffer() instead.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(backported from commit 00db5fa00474f8a83f1aa3b603fd756cc9b49ff4)
common/ctdb_logging.c
common/ctdb_util.c
include/ctdb_private.h