Blame SOURCES/0039-Ticket-47967-cos_cache_build_definition_list-does-no.patch

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