andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From af4c7884bb714ede42b08eed3cc321cbb3c5e33c Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Thu, 18 Dec 2014 09:08:52 -0500
dc8c34
Subject: [PATCH 285/305] Ticket 47750 - During delete operation do not refresh
dc8c34
 cache entry if it is a tombstone
dc8c34
dc8c34
Bug Description:  After calling the betxn postop plugins do not attempt to refresh the
dc8c34
                  entry if it was converted to a tombstone.  A tombstone entry does
dc8c34
                  not have its entry mutex allocated, and it will be dereferenced.
dc8c34
dc8c34
Fix Description:  If the entry is converted to a tombstone, there is no need to
dc8c34
                  refresh it in the first place.  Skip the cache refresh if its a
dc8c34
                  tombstone.  If its not a tombstone, we also need to return the
dc8c34
                  cache entry if it was not changed in betxn postop, because we
dc8c34
                  incremented its refcnt while checking if it was updated.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47750
dc8c34
dc8c34
Reviewed by: nhosoi(Thanks!)
dc8c34
dc8c34
(cherry picked from commit 4ae67943e807b869aeda213dcd39b59feb5f8259)
dc8c34
(cherry picked from commit 83ecd4509b28f6d6b0cd210cd767d6b29026c182)
dc8c34
---
dc8c34
 ldap/servers/slapd/back-ldbm/ldbm_delete.c | 15 +++++++++------
dc8c34
 1 file changed, 9 insertions(+), 6 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
dc8c34
index e86d45f..48058d6 100644
dc8c34
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
dc8c34
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
dc8c34
@@ -1116,12 +1116,15 @@ ldbm_back_delete( Slapi_PBlock *pb )
dc8c34
 
dc8c34
 	/* delete from cache and clean up */
dc8c34
 	if (e) {
dc8c34
-		struct backentry *old_e = e;
dc8c34
-
dc8c34
-		e = cache_find_id(&inst->inst_cache,e->ep_id);
dc8c34
-		if(e != old_e){
dc8c34
-			/* return the old entry, and proceed with the new one */
dc8c34
-			CACHE_RETURN(&inst->inst_cache, &old_e);
dc8c34
+		if(!create_tombstone_entry){
dc8c34
+			struct backentry *old_e = e;
dc8c34
+			e = cache_find_id(&inst->inst_cache,e->ep_id);
dc8c34
+			if(e != old_e){
dc8c34
+				cache_unlock_entry(&inst->inst_cache, old_e);
dc8c34
+				CACHE_RETURN(&inst->inst_cache, &old_e);
dc8c34
+			} else {
dc8c34
+				CACHE_RETURN(&inst->inst_cache, &e);
dc8c34
+			}
dc8c34
 		}
dc8c34
 		if (cache_is_in_cache(&inst->inst_cache, e)) {
dc8c34
 			ep_id = e->ep_id;
dc8c34
-- 
dc8c34
1.9.3
dc8c34