Blame SOURCES/0079-Ticket-47912-Proper-handling-of-No-original_tombston.patch

b161c9
From 8f54c897c404164c618c808435d3887e62d32915 Mon Sep 17 00:00:00 2001
b161c9
From: Noriko Hosoi <nhosoi@redhat.com>
b161c9
Date: Tue, 7 Oct 2014 14:02:20 -0700
b161c9
Subject: [PATCH 79/84] Ticket #47912 - Proper handling of "No
b161c9
 original_tombstone for changenumber" errors
b161c9
b161c9
Bug Description: As analyzed by Ludwig Krispen in
b161c9
  https://fedorahosted.org/389/ticket/47912#comment:1,
b161c9
an error message "No original_tombstone for ..." is always logged
b161c9
if original_tombstone does not exist.  It should be just for the
b161c9
case create_tombstone_entry.
b161c9
b161c9
Fix Description: This patch place the original_tombstone handling
b161c9
in "if (create_tombstone_entry)" clause.
b161c9
b161c9
https://fedorahosted.org/389/ticket/47912
b161c9
b161c9
Reviewed by lkrispen@redhat.com (Thank you, Ludwig!!)
b161c9
b161c9
(cherry picked from commit 36381c120773872d3d4d2cb2417f155e6ac790a6)
b161c9
---
b161c9
 ldap/servers/slapd/back-ldbm/ldbm_delete.c | 48 +++++++++++++++---------------
b161c9
 1 file changed, 24 insertions(+), 24 deletions(-)
b161c9
b161c9
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
b161c9
index 56ea3df..3de8efa 100644
b161c9
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
b161c9
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
b161c9
@@ -225,33 +225,33 @@ ldbm_back_delete( Slapi_PBlock *pb )
b161c9
 			free_delete_existing_entry = 1; /* must free the dup */
b161c9
 			if (create_tombstone_entry) {
b161c9
 				slapi_sdn_set_ndn_byval(&nscpEntrySDN, slapi_sdn_get_ndn(slapi_entry_get_sdn(e->ep_entry)));
b161c9
-			}
b161c9
 
b161c9
-			/* reset tombstone entry */
b161c9
-			if (original_tombstone) {
b161c9
-				/* must duplicate tombstone before returning it to cache,
b161c9
-				 * which could free the entry. */
b161c9
-				if ( (tmptombstone = backentry_dup( original_tombstone )) == NULL ) {
b161c9
-					ldap_result_code= LDAP_OPERATIONS_ERROR;
b161c9
-					goto error_return;
b161c9
-				}
b161c9
-				if (cache_is_in_cache(&inst->inst_cache, tombstone)) {
b161c9
-					CACHE_REMOVE(&inst->inst_cache, tombstone);
b161c9
-				}
b161c9
-				CACHE_RETURN(&inst->inst_cache, &tombstone);
b161c9
-				if (tombstone) {
b161c9
+				/* reset tombstone entry */
b161c9
+				if (original_tombstone) {
b161c9
+					/* must duplicate tombstone before returning it to cache,
b161c9
+					 * which could free the entry. */
b161c9
+					if ( (tmptombstone = backentry_dup( original_tombstone )) == NULL ) {
b161c9
+						ldap_result_code= LDAP_OPERATIONS_ERROR;
b161c9
+						goto error_return;
b161c9
+					}
b161c9
+					if (cache_is_in_cache(&inst->inst_cache, tombstone)) {
b161c9
+						CACHE_REMOVE(&inst->inst_cache, tombstone);
b161c9
+					}
b161c9
+					CACHE_RETURN(&inst->inst_cache, &tombstone);
b161c9
+					if (tombstone) {
b161c9
+						slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete", 
b161c9
+						                "conn=%lu op=%d [retry: %d] tombstone %s is not freed!!! refcnt %d, state %d\n",
b161c9
+						                conn_id, op_id, retry_count, slapi_entry_get_dn(tombstone->ep_entry),
b161c9
+						                tombstone->ep_refcnt, tombstone->ep_state);
b161c9
+					}
b161c9
+					tombstone = original_tombstone;
b161c9
+					original_tombstone = tmptombstone;
b161c9
+					tmptombstone = NULL;
b161c9
+				} else {
b161c9
 					slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete", 
b161c9
-					                "conn=%lu op=%d [retry: %d] tombstone %s is not freed!!! refcnt %d, state %d\n",
b161c9
-					                conn_id, op_id, retry_count, slapi_entry_get_dn(tombstone->ep_entry),
b161c9
-					                tombstone->ep_refcnt, tombstone->ep_state);
b161c9
+					                "conn=%lu op=%d [retry: %d] No original_tombstone for %s!!\n",
b161c9
+					                conn_id, op_id, retry_count, slapi_entry_get_dn(e->ep_entry));
b161c9
 				}
b161c9
-				tombstone = original_tombstone;
b161c9
-				original_tombstone = tmptombstone;
b161c9
-				tmptombstone = NULL;
b161c9
-			} else {
b161c9
-				slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete", 
b161c9
-				                "conn=%lu op=%d [retry: %d] No original_tombstone for %s!!\n",
b161c9
-				                conn_id, op_id, retry_count, slapi_entry_get_dn(e->ep_entry));
b161c9
 			}
b161c9
 			if (ruv_c_init) {
b161c9
 				/* reset the ruv txn stuff */
b161c9
-- 
b161c9
1.9.3
b161c9