From 16a41fe9e2fa6cc8f437205a3bea41b2d4bfb858 Mon Sep 17 00:00:00 2001 From: Aaron Haslett 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 Reviewed-by: Jeremy Allison Reviewed-by: Andrew Bartlett (cherry picked from commit 3713905f8b4baa56b1bf571f71009cd77ccda6eb) --- 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 5f9a71d..987e109 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