andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From fb0a01cbb239b75681535e329782e2e6309fc41c Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Thu, 25 Jul 2013 16:41:01 -0400
Subject: [PATCH 86/99] Ticket 47449 - deadlock after adding and deleting
 entries

Bug Description:  If multiple clients are each doing their own add/delete of the same entries,
                  the server will deadlock very quickly.

Fix Description:  The server was not signaling an error when it failed to lock the parent
                  entry lock.  I've checked add/mod/modrdn functions as well, and they do correctly
                  unlock the cache entry(this includes the old/new superior for modrdn).

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

Reviewed by: richm(Thanks!)
(cherry picked from commit 66fbebc7d4c6552fcbbea7351dea5527d88195a1)
---
 ldap/servers/slapd/back-ldbm/ldbm_delete.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 3cf58f4..a3dc17b 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -340,6 +340,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 			if (parent && cache_lock_entry(&inst->inst_cache, parent)) {
 				/* Failed to obtain parent entry's entry lock */
 				CACHE_RETURN(&(inst->inst_cache), &parent);
+				retval = -1;
 				goto error_return;
 			}
 		}
@@ -509,9 +510,9 @@ ldbm_back_delete( Slapi_PBlock *pb )
 			               "Delete Retrying Transaction\n");
 #ifndef LDBM_NO_BACKOFF_DELAY
 			{
-			PRIntervalTime interval;
-			interval = PR_MillisecondsToInterval(slapi_rand() % 100);
-			DS_Sleep(interval);
+				PRIntervalTime interval;
+				interval = PR_MillisecondsToInterval(slapi_rand() % 100);
+				DS_Sleep(interval);
 			}
 #endif
 		}
-- 
1.8.1.4