Просмотр исходного кода

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>
Angus Salkeld 15 лет назад
Родитель
Сommit
5da0251a42
2 измененных файлов с 3 добавлено и 2 удалено
  1. 1 1
      exec/coroipcs.c
  2. 2 1
      services/confdb.c

+ 1 - 1
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);

+ 2 - 1
services/confdb.c

@@ -342,7 +342,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);
 }
@@ -829,6 +829,7 @@ retry_write:
 	if (written == sizeof(struct confdb_ipc_message_holder)) {
 		return 0;
 	} else {
+		api->ipc_refcnt_dec(conn);
 		return -1;
 	}
 }