Re: [PATCH] Free confdb message holder list on confdb exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ACK.

what about other services?

Fabio

On 04/25/2013 04:41 PM, Jan Friesse wrote:
> This operation will not only properly free memory, but also decreases
> connection reference(s). This should solve deadloop in
> coroipcs_ipc_service_exit, because confdb_exit_fn removes not only
> notify_pipe but also deletes poll_dispatch, so nobody is left to
> unreference connections.
> 
> Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
> ---
>  services/confdb.c |   20 ++++++++++++++++++++
>  1 files changed, 20 insertions(+), 0 deletions(-)
> 
> diff --git a/services/confdb.c b/services/confdb.c
> index 1559604..acedb96 100644
> --- a/services/confdb.c
> +++ b/services/confdb.c
> @@ -348,11 +348,31 @@ __attribute__ ((constructor)) static void corosync_lcr_component_register (void)
>  	lcr_component_register (&confdb_comp_ver0);
>  }
>  
> +static void free_confdb_ipc_message_holder_list(void)
> +{
> +	struct confdb_ipc_message_holder *holder;
> +
> +	pthread_mutex_lock (&confdb_ipc_message_holder_list_mutex);
> +
> +	while (!list_empty (&confdb_ipc_message_holder_list_head)) {
> +		holder = list_entry (confdb_ipc_message_holder_list_head.next,
> +			    struct confdb_ipc_message_holder, list);
> +		list_del (&holder->list);
> +		api->ipc_refcnt_dec(holder->conn);
> +		free(holder);
> +	}
> +
> +	pthread_mutex_unlock (&confdb_ipc_message_holder_list_mutex);
> +}
> +
>  static int confdb_exec_exit_fn(void)
>  {
>  	api->poll_dispatch_delete(api->poll_handle_get(), notify_pipe[0]);
>  	close(notify_pipe[0]);
>  	close(notify_pipe[1]);
> +
> +	free_confdb_ipc_message_holder_list();
> +
>  	return 0;
>  }
>  
> 

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux