Blob Blame Raw
From 49ca93665ac6c2faf6077d6a8dc33cbea6bd0fc9 Mon Sep 17 00:00:00 2001
From: Thierry Bordaz <tbordaz@redhat.com>
Date: Tue, 4 Apr 2017 10:44:55 +0200
Subject: [PATCH] Ticket 49209 - Hang due to omitted replica lock release

Bug Description:
    When an operation is canceled (failure), its csn is aborted
    and removed from the pending list.
    If at that time the pending list is empty or the csn is not found
    in that list, the cancel callback forgots to release the replica lock

Fix Description:
    Release replica lock systematically, whether cnsplRemove fails or not

https://pagure.io/389-ds-base/issue/49209

Reviewed by: Mark Reynolds (thanks Mark !!)

Platforms tested: F23

Flag Day: no

Doc impact: no

(cherry picked from commit 7dc991b16b97bacb69ddb334358e27e1220ca27b)
(cherry picked from commit 071cadabb035fbca354a233adbeba82616be3d19)
---
 ldap/servers/plugins/replication/repl5_replica.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index 602653a..9b3cec5 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -3669,7 +3669,9 @@ abort_csn_callback(const CSN *csn, void *data)
     {
         int rc = csnplRemove(r->min_csn_pl, csn);
         if (rc) {
-            slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "csnplRemove failed");
+            slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, 
+                    "abort_csn_callback - csnplRemove failed");
+            replica_unlock(r->repl_lock);
             return;
         }
     }
-- 
2.9.3