From 28027d3f0d3f6df742c1a8360c75c7a922cb1819 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Thu, 4 Dec 2014 11:11:13 -0500 Subject: [PATCH 39/53] Ticket 47967 - cos_cache_build_definition_list does not stop during server shutdown Bug Description: If the COS cache is being rebuilt (where there are many COS definitions/templates), attempting to stop the server can take take a very long time. Fix Description: In the callback functions check for server shutdown to abort out of the search callback loops. https://fedorahosted.org/389/ticket/47967 Reviewed by: nhosoi(Thanks!) (cherry picked from commit 99f99743617c1d082e748e7d3e83adf953d2ad05) (cherry picked from commit f2df95ea7a78e95535eaf798fdf3edff9cb33b72) --- ldap/servers/plugins/cos/cos_cache.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c index 3f3841f..a7993c8 100644 --- a/ldap/servers/plugins/cos/cos_cache.c +++ b/ldap/servers/plugins/cos/cos_cache.c @@ -725,7 +725,7 @@ struct dn_defs_info { /* * Currently, always returns 0 to continue the search for definitions, even * if a particular attempt to add a definition fails: info.ret gets set to - * zero only if we succed to add a def. + * zero only if we succeed to add a def. */ static int cos_dn_defs_cb (Slapi_Entry* e, void *callback_data) @@ -1056,10 +1056,10 @@ bail: /* This particular definition may not have yielded anything * worth caching (eg. no template was found for it) but * that should not cause us to abort the search for other more well behaved - * definitions. + * definitions unless we are shutting down. * return info->ret; - */ - return (0); + */ + return slapi_is_shutting_down(); } @@ -1116,7 +1116,7 @@ struct tmpl_info { /* * Currently, always returns 0 to continue the search for templates, even * if a particular attempt to add a template fails: info.ret gets set to - * zero only if we succed to add at least one tmpl. + * zero only if we succeed to add at least one tmpl. */ static int cos_dn_tmpl_entries_cb (Slapi_Entry* e, void *callback_data) { cosAttrValue *pDn = 0; @@ -1166,7 +1166,7 @@ static int cos_dn_tmpl_entries_cb (Slapi_Entry* e, void *callback_data) { if(pSneakyVal == NULL) { - /* look for the atrribute in the dynamic attributes */ + /* look for the attribute in the dynamic attributes */ if(cos_cache_attrval_exists(info->pAttrs, attrType)) { pSneakyVal = &pCosAttribute; @@ -1269,10 +1269,10 @@ static int cos_dn_tmpl_entries_cb (Slapi_Entry* e, void *callback_data) { } } /* - * Always contine the search even if a particular attempt - * to add a template failed. - */ - return 0; + * Always continue the search even if a particular attempt + * to add a template failed unless we are shutting down + */ + return slapi_is_shutting_down(); } /* -- 1.9.3