andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From b73c70b03a5dcde754ec95307c62c6cf15977cff Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Fri, 28 Jun 2013 13:34:54 -0700
dc8c34
Subject: [PATCH 52/99] Ticket #47412 - Modify RUV should be serialized in
dc8c34
 ldbm_back_modify/add
dc8c34
dc8c34
Bug Description: Current ldbm_back_modify and _add allow RUV to
dc8c34
update without respecting other threads in the backend's critical
dc8c34
area. It gives a chance for 2 threads trying to modify RUV at the
dc8c34
same time in the 2 different transactions which causes the DB
dc8c34
deadlocks.
dc8c34
dc8c34
Fix Description: This patch changes the policy for RUV to skip
dc8c34
the backend serial lock.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47412
dc8c34
dc8c34
Reviewed by Rich (Thank you!!)
dc8c34
(cherry picked from commit bc62f8276924f836613a311a0f133c9b548fad9a)
dc8c34
---
dc8c34
 ldap/servers/slapd/back-ldbm/ldbm_add.c    |  2 +-
dc8c34
 ldap/servers/slapd/back-ldbm/ldbm_modify.c | 12 +++++++++---
dc8c34
 2 files changed, 10 insertions(+), 4 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c
dc8c34
index 158dc8e..78ca565 100644
dc8c34
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
dc8c34
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
dc8c34
@@ -159,7 +159,7 @@ ldbm_back_add( Slapi_PBlock *pb )
dc8c34
 	 * operations that the URP code in the Replication
dc8c34
 	 * plugin generates.
dc8c34
 	 */
dc8c34
-	if(SERIALLOCK(li) && !is_fixup_operation)
dc8c34
+	if(SERIALLOCK(li) && (!is_fixup_operation || is_ruv))
dc8c34
 	{
dc8c34
 		dblayer_lock_backend(be);
dc8c34
 		dblock_acquired= 1;
dc8c34
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
dc8c34
index 5c9585f..66b8ab8 100644
dc8c34
--- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c
dc8c34
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
dc8c34
@@ -394,7 +394,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
dc8c34
 	 * operations that the URP code in the Replication
dc8c34
 	 * plugin generates.
dc8c34
 	 */
dc8c34
-	if(SERIALLOCK(li) && !operation_is_flag_set(operation,OP_FLAG_REPL_FIXUP)) {
dc8c34
+	if(SERIALLOCK(li) && (!is_fixup_operation || is_ruv)) {
dc8c34
 		dblayer_lock_backend(be);
dc8c34
 		dblock_acquired= 1;
dc8c34
 	}
dc8c34
@@ -405,8 +405,14 @@ ldbm_back_modify( Slapi_PBlock *pb )
dc8c34
 		goto error_return;	  /* error result sent by find_entry2modify() */
dc8c34
 	}
dc8c34
 
dc8c34
-	if ( !is_fixup_operation )
dc8c34
-	{
dc8c34
+	if (!is_fixup_operation) {
dc8c34
+		if (slapi_entry_flag_is_set(e->ep_entry, SLAPI_ENTRY_FLAG_TOMBSTONE)) {
dc8c34
+			ldap_result_code = LDAP_UNWILLING_TO_PERFORM;
dc8c34
+			ldap_result_message = "Operation not allowed on tombstone entry.";
dc8c34
+			slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_modify",
dc8c34
+			    "Attempt to modify a tombstone entry %s\n", slapi_sdn_get_dn(slapi_entry_get_sdn_const( e->ep_entry )));
dc8c34
+			goto error_return;
dc8c34
+		}
dc8c34
 		opcsn = operation_get_csn (operation);
dc8c34
 		if (NULL == opcsn && operation->o_csngen_handler)
dc8c34
 		{
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34