amoralej / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 years ago
Clone
Blob Blame History Raw
From 74df3c57e0de786f001285429501c518d70abb13 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Wed, 13 Jul 2016 16:24:19 -0400
Subject: [PATCH 07/15] Ticket 48922 - Fix crash when deleting backend while
 import is running

Bug Description:  If you delete a backend from the config while an
                  import is running the server can crash.

Fix Description:  When deleting a backend from the config wait for the
                  backend instance to not be busy before removing the
                  indexes.  Otherwise the dbenv is not stable and this
                  can cause the crash.

https://fedorahosted.org/389/ticket/48922

Reviewed by: nhosoi(Thanks!)

(cherry picked from commit 6c77c37ae5ce847ffa2bd75287dbd157c2f2d6af)
---
 ldap/servers/slapd/back-ldbm/ldbm_index_config.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
index 3e59e72..c5ceacf 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
@@ -151,6 +151,12 @@ ldbm_instance_index_config_delete_callback(Slapi_PBlock *pb, Slapi_Entry* e, Sla
     rc = SLAPI_DSE_CALLBACK_ERROR;
     goto bail;
   }
+
+  while(is_instance_busy(inst)){
+    /* Wait for import/indexing job to complete */
+    DS_Sleep(PR_SecondsToInterval(1));
+  }
+
   *returncode = LDAP_SUCCESS;
   
   slapi_entry_attr_find(e, "cn", &attr);
-- 
2.4.11