Fix shutdown when a confdb client is still connected

If you are connected to corosync and registered for
object notifications then corosync is asked to shutdown
the IPC server will get stuck. This is because the pipe
is closed and the refcount is increased. This leaves ipcs
with a connection that it can't destroy.

Solution:
1) if a write to the pipe fails (pipe closed) decrement the refcounter.
2) fix the object_track_stop() - it was not working as the functions
   did not match up. (this caused the late callbacks).
3) in ipcs call exit_fn() then stats_destroy_connection() so that
   the service engine can have time to call object_track_stop()
   before the object gets destroyed.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
This commit is contained in:
Angus Salkeld 2011-03-29 13:25:04 +11:00
parent 076e8b74f7
commit 265661745d
2 changed files with 3 additions and 2 deletions

View File

@ -527,8 +527,8 @@ static inline int conn_info_destroy (struct conn_info *conn_info)
* Retry library exit function if busy
*/
if (conn_info->state == CONN_STATE_THREAD_DESTROYED) {
api->stats_destroy_connection (conn_info->stats_handle);
res = api->exit_fn_get (conn_info->service) (conn_info);
api->stats_destroy_connection (conn_info->stats_handle);
if (res == -1) {
api->serialize_unlock ();
return (0);

View File

@ -348,7 +348,7 @@ static int confdb_lib_exit_fn (void *conn)
api->object_track_stop(confdb_notify_lib_of_key_change,
confdb_notify_lib_of_new_object,
confdb_notify_lib_of_destroyed_object,
NULL,
confdb_notify_lib_of_reload,
conn);
return (0);
}
@ -857,6 +857,7 @@ retry_write:
if (written == sizeof(struct confdb_ipc_message_holder)) {
return 0;
} else {
api->ipc_refcnt_dec(conn);
return -1;
}
}