[PATCH] DNS dlz_bind9 reference count logging

Jeremy Allison jra at samba.org
Tue Oct 16 20:37:57 UTC 2018


On Tue, Oct 16, 2018 at 05:36:33PM +1300, Aaron Haslett via samba-technical wrote:
> dlz_bind9 has to count the number of times the plugin is 'created' by
> bind's plugin manager so it doesn't repeat setup.  Logging doesn't
> reflect this reference counting logic properly and so messages like
> "samba_dlz: shutdown" can, confusingly, come up when the database
> connection has not actually been severed.  This patch adds the necessary
> logging.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13655
> 
> CI: https://gitlab.com/catalyst-samba/samba/pipelines/32943606

LGTM. RB+. Can I get a second Team reviewer ?

Jeremy.

> From 81171bd4c7082e7d673a5a24d6a6a342da351796 Mon Sep 17 00:00:00 2001
> From: Aaron Haslett <aaronhaslett at catalyst.net.nz>
> Date: Mon, 15 Oct 2018 16:52:40 +1300
> Subject: [PATCH] dns: dlz_bind9 reference count logging
> 
> dlz_bind9 has to count the number of times the plugin is 'created' by bind's
> plugin manager so it doesn't repeat setup.  Logging doesn't reflect this
> reference counting logic properly and so messages like "samba_dlz: shutdown"
> can, confusingly, come up when the database connection has not actually been
> severed.  This patch adds the necessary logging.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13655
> Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
> ---
>  source4/dns_server/dlz_bind9.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/source4/dns_server/dlz_bind9.c b/source4/dns_server/dlz_bind9.c
> index 054f13e..43f3e57 100644
> --- a/source4/dns_server/dlz_bind9.c
> +++ b/source4/dns_server/dlz_bind9.c
> @@ -618,6 +618,9 @@ _PUBLIC_ isc_result_t dlz_create(const char *dlzname,
>  	char *errstring = NULL;
>  
>  	if (dlz_bind9_state != NULL) {
> +		dlz_bind9_state->log(ISC_LOG_ERROR,
> +				     "samba_dlz: dlz_create ignored, #refs=%d",
> +				     dlz_bind9_state_ref_count);
>  		*dbdata = dlz_bind9_state;
>  		dlz_bind9_state_ref_count++;
>  		return ISC_R_SUCCESS;
> @@ -743,6 +746,10 @@ _PUBLIC_ isc_result_t dlz_create(const char *dlzname,
>  	return ISC_R_SUCCESS;
>  
>  failed:
> +	state->log(ISC_LOG_INFO,
> +		   "samba_dlz: FAILED dlz_create call result=%d #refs=%d",
> +		   result,
> +		   dlz_bind9_state_ref_count);
>  	talloc_free(state);
>  	return result;
>  }
> @@ -753,13 +760,17 @@ failed:
>  _PUBLIC_ void dlz_destroy(void *dbdata)
>  {
>  	struct dlz_bind9_data *state = talloc_get_type_abort(dbdata, struct dlz_bind9_data);
> -	state->log(ISC_LOG_INFO, "samba_dlz: shutting down");
>  
>  	dlz_bind9_state_ref_count--;
>  	if (dlz_bind9_state_ref_count == 0) {
> +		state->log(ISC_LOG_INFO, "samba_dlz: shutting down");
>  		talloc_unlink(state, state->samdb);
>  		talloc_free(state);
>  		dlz_bind9_state = NULL;
> +	} else {
> +		state->log(ISC_LOG_INFO,
> +			   "samba_dlz: dlz_destroy called. %d refs remaining.",
> +			   dlz_bind9_state_ref_count);
>  	}
>  }
>  
> -- 
> 2.7.4
> 




More information about the samba-technical mailing list