From 265661745d81c7293764a220ea97e1546b1c2878 Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Tue, 29 Mar 2011 13:25:04 +1100 Subject: [PATCH] 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 Reviewed-by: Steven Dake --- exec/coroipcs.c | 2 +- services/confdb.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/exec/coroipcs.c b/exec/coroipcs.c index 29655ba3..dbafb18e 100644 --- a/exec/coroipcs.c +++ b/exec/coroipcs.c @@ -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); diff --git a/services/confdb.c b/services/confdb.c index 31877182..b57a0412 100644 --- a/services/confdb.c +++ b/services/confdb.c @@ -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; } }