andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame SOURCES/0056-Ticket-47750-During-delete-operation-do-not-refresh-.patch

f92ce9
From 6649bbb2900841a101ab60ef43d55742ee3abb9a Mon Sep 17 00:00:00 2001
f92ce9
From: Mark Reynolds <mreynolds@redhat.com>
f92ce9
Date: Thu, 18 Dec 2014 09:08:52 -0500
f92ce9
Subject: [PATCH] Ticket 47750 - During delete operation do not refresh cache
f92ce9
 entry if it is a tombstone
f92ce9
f92ce9
Bug Description:  After calling the betxn postop plugins do not attempt to refresh the
f92ce9
                  entry if it was converted to a tombstone.  A tombstone entry does
f92ce9
                  not have its entry mutex allocated, and it will be dereferenced.
f92ce9
f92ce9
Fix Description:  If the entry is converted to a tombstone, there is no need to
f92ce9
                  refresh it in the first place.  Skip the cache refresh if its a
f92ce9
                  tombstone.  If its not a tombstone, we also need to return the
f92ce9
                  cache entry if it was not changed in betxn postop, because we
f92ce9
                  incremented its refcnt while checking if it was updated.
f92ce9
f92ce9
https://fedorahosted.org/389/ticket/47750
f92ce9
f92ce9
Reviewed by: nhosoi(Thanks!)
f92ce9
f92ce9
(cherry picked from commit 4ae67943e807b869aeda213dcd39b59feb5f8259)
f92ce9
(cherry picked from commit f63473228d05c56a096580ec5e66566b35ab4535)
f92ce9
---
f92ce9
 ldap/servers/slapd/back-ldbm/ldbm_delete.c | 10 ++++++++++
f92ce9
 1 file changed, 10 insertions(+)
f92ce9
f92ce9
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
f92ce9
index 5f12ea3..56ea3df 100644
f92ce9
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
f92ce9
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
f92ce9
@@ -1261,6 +1261,16 @@ ldbm_back_delete( Slapi_PBlock *pb )
f92ce9
 
f92ce9
 	/* delete from cache and clean up */
f92ce9
 	if (e) {
f92ce9
+		if(!create_tombstone_entry){
f92ce9
+			struct backentry *old_e = e;
f92ce9
+			e = cache_find_id(&inst->inst_cache,e->ep_id);
f92ce9
+			if(e != old_e){
f92ce9
+				cache_unlock_entry(&inst->inst_cache, old_e);
f92ce9
+				CACHE_RETURN(&inst->inst_cache, &old_e);
f92ce9
+			} else {
f92ce9
+				CACHE_RETURN(&inst->inst_cache, &e);
f92ce9
+			}
f92ce9
+		}
f92ce9
 		if (cache_is_in_cache(&inst->inst_cache, e)) {
f92ce9
 			ep_id = e->ep_id; /* Otherwise, e might have been freed. */
f92ce9
 			CACHE_REMOVE(&inst->inst_cache, e);
f92ce9
-- 
f92ce9
1.9.3
f92ce9