[Openais] [PATCH] Fix shutdown when a confdb client is still connected

Steven Dake sdake at redhat.com
Mon Mar 28 19:32:09 PDT 2011


Reviewed-by: Steven Dake <sdake at redhat.com>

On 03/28/2011 07:25 PM, Angus Salkeld wrote:
> 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 at redhat.com>
> ---
>  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 29655ba..dbafb18 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 3187718..b57a041 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;
>  	}
>  }



More information about the Openais mailing list