andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From 072b6270f04618f486094e5ca712bf8e2f6dc2e2 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Fri, 7 Mar 2014 14:07:01 -0500
Subject: [PATCH 172/225] Ticket 47729 - Directory Server crashes if shutdown
 during a replication initialization

Bug Description:  When a shutdown was detected we marked that the total update was done
                  prematurely(prp->stopped).  This allowed the replication plugin to close
                  while the total update was still in progress. Other plugins continued to
                  be shutdown (e.g. ldbm database), while the total update was using shared
                  resources - which lead to a crash.

Fix Description:  Only mark the total update protocol as stopped, after it is finished using
                  shared resources.

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

Reviewed by: nhosoi(Thanks!)
(cherry picked from commit e7f7e9127717c1d432b10493b626fed334cc595f)
(cherry picked from commit e0fd1ffcd84d533e4cd62aae15aea504677798ab)
---
 ldap/servers/plugins/replication/repl5_tot_protocol.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/ldap/servers/plugins/replication/repl5_tot_protocol.c b/ldap/servers/plugins/replication/repl5_tot_protocol.c
index b10d2d0..9829984 100644
--- a/ldap/servers/plugins/replication/repl5_tot_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_tot_protocol.c
@@ -340,7 +340,6 @@ repl5_tot_run(Private_Repl_Protocol *prp)
 	prp->stopped = 0;
 	if (prp->terminate)
 	{
-        prp->stopped = 1;
 		goto done;
 	}
 
@@ -362,8 +361,7 @@ repl5_tot_run(Private_Repl_Protocol *prp)
     }
 	else if (prp->terminate)
     {
-        conn_disconnect(prp->conn);
-        prp->stopped = 1;
+		conn_disconnect(prp->conn);
 		goto done;    
     }
 	
@@ -646,7 +644,6 @@ int send_entry (Slapi_Entry *e, void *cb_data)
     if (prp->terminate)
     {
         conn_disconnect(prp->conn);
-        prp->stopped = 1;
 		((callback_data*)cb_data)->rc = -1;
 		return -1;    
     }
@@ -659,7 +656,6 @@ int send_entry (Slapi_Entry *e, void *cb_data)
     if (rc)
     {
         conn_disconnect(prp->conn);
-        prp->stopped = 1;
         ((callback_data*)cb_data)->rc = -1;
         return -1;
     }
-- 
1.8.1.4