ldap/servers/slapd/back-ldbm/ldbm_add.c | 66 ++++++++++++-----------------
ldap/servers/slapd/back-ldbm/ldbm_delete.c | 47 ++++++++++++++------
ldap/servers/slapd/back-ldbm/ldbm_modify.c | 19 +++++---
ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 48 ++++++++++++++++-----
4 files changed, 112 insertions(+), 68 deletions(-)
New commits:
commit 1ae9a087b5f2401433a823903b3d7ee9744f1df9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 9 17:21:10 2010 -0800
563365 - Error handling problems in the backend functions
https://bugzilla.redhat.com/show_bug.cgi?id=563365
Error handling in ldbm_back_{add,delete,modify,modrdn} functions was
incomplete. When any error occurs after the transaction begins, the
changes made after that should be aborted. There were some cases the
abort was not called.
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c
b/ldap/servers/slapd/back-ldbm/ldbm_add.c
index 95a93cc..3bd6eae 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
@@ -50,6 +50,12 @@ extern char *hassubordinates;
static void delete_update_entry_dn_operational_attributes(struct backentry *ep);
+#define ADD_SET_ERROR(rc, error, count) \
+{ \
+ (rc) = (error); \
+ (count) = RETRY_TIMES; /* otherwise, the transaction may not be aborted */ \
+}
+
/* in order to find the parent, we must have either the parent dn or uniqueid
This function will return true if either are set, or false otherwise */
static int
@@ -632,14 +638,11 @@ ldbm_back_add( Slapi_PBlock *pb )
if (retval != 0) {
LDAPDebug( LDAP_DEBUG_TRACE, "id2entry_add failed, err=%d %s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+ ADD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
if (LDBM_OS_ERR_IS_DISKFULL(retval)) {
disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
goto diskfull_return;
}
- ldap_result_code= LDAP_OPERATIONS_ERROR;
- retry_count = RETRY_TIMES; /* otherwise, the transaction may not
- be aborted */
goto error_return;
}
if(is_resurect_operation)
@@ -653,14 +656,12 @@ ldbm_back_add( Slapi_PBlock *pb )
if (0 != retval) {
LDAPDebug( LDAP_DEBUG_TRACE, "add 1 BAD, err=%d %s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+ ADD_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
if (LDBM_OS_ERR_IS_DISKFULL(retval)) {
disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
goto diskfull_return;
}
- ldap_result_code= LDAP_OPERATIONS_ERROR;
- retry_count = RETRY_TIMES; /* otherwise, the transaction may not
- be aborted */
goto error_return;
}
retval =
index_addordel_string(be,SLAPI_ATTR_UNIQUEID,slapi_entry_get_uniqueid(addingentry->ep_entry),addingentry->ep_id,BE_INDEX_DEL,&txn);
@@ -672,14 +673,12 @@ ldbm_back_add( Slapi_PBlock *pb )
if (0 != retval) {
LDAPDebug( LDAP_DEBUG_TRACE, "add 2 BAD, err=%d %s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+ ADD_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
if (LDBM_OS_ERR_IS_DISKFULL(retval)) {
disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
goto diskfull_return;
}
- ldap_result_code= LDAP_OPERATIONS_ERROR;
- retry_count = RETRY_TIMES; /* otherwise, the transaction may not
- be aborted */
goto error_return;
}
retval =
index_addordel_string(be,SLAPI_ATTR_NSCP_ENTRYDN,slapi_sdn_get_ndn(&sdn),addingentry->ep_id,BE_INDEX_DEL,&txn);
@@ -691,14 +690,12 @@ ldbm_back_add( Slapi_PBlock *pb )
if (0 != retval) {
LDAPDebug( LDAP_DEBUG_TRACE, "add 3 BAD, err=%d %s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+ ADD_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
if (LDBM_OS_ERR_IS_DISKFULL(retval)) {
disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
goto diskfull_return;
}
- ldap_result_code= LDAP_OPERATIONS_ERROR;
- retry_count = RETRY_TIMES; /* otherwise, the transaction may not
- be aborted */
goto error_return;
}
}
@@ -719,14 +716,11 @@ ldbm_back_add( Slapi_PBlock *pb )
if (retval != 0) {
LDAPDebug( LDAP_DEBUG_ANY, "add: attempt to index %lu failed\n",
(u_long)addingentry->ep_id, 0, 0 );
+ ADD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
if (LDBM_OS_ERR_IS_DISKFULL(retval)) {
disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
goto diskfull_return;
}
- ldap_result_code= LDAP_OPERATIONS_ERROR;
- retry_count = RETRY_TIMES; /* otherwise, the transaction may not
- be aborted */
goto error_return;
}
if (parent_found) {
@@ -741,14 +735,12 @@ ldbm_back_add( Slapi_PBlock *pb )
if (0 != retval) {
LDAPDebug( LDAP_DEBUG_TRACE, "add 1 BAD, err=%d %s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+ ADD_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
if (LDBM_OS_ERR_IS_DISKFULL(retval)) {
disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
goto diskfull_return;
}
- ldap_result_code= LDAP_OPERATIONS_ERROR;
- retry_count = RETRY_TIMES; /* otherwise, the transaction may not
- be aborted */
goto error_return;
}
}
@@ -768,14 +760,12 @@ ldbm_back_add( Slapi_PBlock *pb )
LDAPDebug( LDAP_DEBUG_TRACE,
"vlv_update_index failed, err=%d %s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+ ADD_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
if (LDBM_OS_ERR_IS_DISKFULL(retval)) {
disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
goto diskfull_return;
}
- ldap_result_code= LDAP_OPERATIONS_ERROR;
- retry_count = RETRY_TIMES; /* otherwise, the transaction may not
- be aborted */
goto error_return;
}
}
@@ -805,8 +795,8 @@ ldbm_back_add( Slapi_PBlock *pb )
if (cache_replace( &inst->inst_cache, tombstoneentry, addingentry ) != 0 )
{
/* This happens if the dn of addingentry already exists */
- ldap_result_code= LDAP_ALREADY_EXISTS;
cache_unlock_entry( &inst->inst_cache, tombstoneentry );
+ ADD_SET_ERROR(ldap_result_code, LDAP_ALREADY_EXISTS, retry_count);
goto error_return;
}
/*
@@ -819,19 +809,18 @@ ldbm_back_add( Slapi_PBlock *pb )
}
if (parent_found)
{
- /* switch the parent entry copy into play */
+ /* switch the parent entry copy into play */
modify_switch_entries( &parent_modify_c,be);
}
retval = dblayer_txn_commit(li,&txn);
if (0 != retval)
{
+ ADD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
if (LDBM_OS_ERR_IS_DISKFULL(retval)) {
disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
goto diskfull_return;
}
- ldap_result_code= LDAP_OPERATIONS_ERROR;
goto error_return;
}
@@ -863,16 +852,17 @@ error_return:
disk_full = 1;
}
- /* It is safer not to abort when the transaction is not started. */
- if (retry_count > 0) {
- dblayer_txn_abort(li,&txn); /* abort crashes in case disk full */
- }
diskfull_return:
- if (disk_full)
+ if (disk_full) {
rc= return_on_disk_full(li);
- else
+ } else {
+ /* It is safer not to abort when the transaction is not started. */
+ if (retry_count > 0) {
+ dblayer_txn_abort(li,&txn); /* abort crashes in case disk full */
+ }
rc= SLAPI_FAIL_GENERAL;
+ }
common_return:
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index fdccc0f..bc298a9 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -45,6 +45,12 @@
#include "back-ldbm.h"
+#define DEL_SET_ERROR(rc, error, count) \
+{ \
+ (rc) = (error); \
+ (count) = RETRY_TIMES; /* otherwise, the transaction may not be aborted */ \
+}
+
int
ldbm_back_delete( Slapi_PBlock *pb )
{
@@ -430,7 +436,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
LDAPDebug( LDAP_DEBUG_ANY, "id2entry_add failed, err=%d %s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
tombstone_in_cache = 1;
@@ -450,7 +457,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
LDBM_OS_ERR_IS_DISKFULL(retval)) {
disk_full = 1;
}
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
}
@@ -469,7 +477,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
}
if (retval != 0) {
LDAPDebug( LDAP_DEBUG_TRACE, "index_del_entry failed\n", 0, 0, 0 );
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
if(create_tombstone_entry)
@@ -495,7 +503,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
SLAPI_ATTR_VALUE_TOMBSTONE, retval,
(msg = dblayer_strerror( retval )) ? msg : "" );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
retval = index_addordel_string(be, SLAPI_ATTR_UNIQUEID,
@@ -514,7 +523,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
SLAPI_ATTR_UNIQUEID, retval,
(msg = dblayer_strerror( retval )) ? msg : "" );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
retval = index_addordel_string(be, SLAPI_ATTR_NSCP_ENTRYDN,
@@ -533,7 +543,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
SLAPI_ATTR_NSCP_ENTRYDN, retval,
(msg = dblayer_strerror( retval )) ? msg : "" );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
/* add a new usn to the entryusn index */
@@ -556,7 +567,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
SLAPI_ATTR_ENTRYUSN, retval,
(msg = dblayer_strerror( retval )) ? msg : "" );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
}
@@ -579,7 +591,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
SLAPI_ATTR_ENTRYUSN, retval,
(msg = dblayer_strerror( retval )) ? msg : "" );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
}
@@ -608,7 +621,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
SLAPI_ATTR_VALUE_TOMBSTONE, retval,
(msg = dblayer_strerror( retval )) ? msg : "" );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
retval = index_addordel_string(be, SLAPI_ATTR_UNIQUEID,
@@ -627,7 +641,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
SLAPI_ATTR_UNIQUEID, retval,
(msg = dblayer_strerror( retval )) ? msg : "" );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
@@ -650,7 +665,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
SLAPI_ATTR_NSCP_ENTRYDN, retval,
(msg = dblayer_strerror( retval )) ? msg : "" );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
}
@@ -675,7 +691,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
SLAPI_ATTR_ENTRYUSN, retval,
(msg = dblayer_strerror( retval )) ? msg : "" );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
}
@@ -694,7 +711,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
LDAPDebug( LDAP_DEBUG_TRACE, "delete 3 BAD, err=%d %s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
}
@@ -714,7 +732,8 @@ ldbm_back_delete( Slapi_PBlock *pb )
}
if (retval != 0 ) {
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ DEL_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c
b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
index 9324c8d..3e2b9e9 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
@@ -50,6 +50,12 @@ extern char *hassubordinates;
static void remove_illegal_mods(LDAPMod **mods);
static int mods_have_effect (Slapi_Entry *entry, Slapi_Mods *smods);
+#define MOD_SET_ERROR(rc, error, count) \
+{ \
+ (rc) = (error); \
+ (count) = RETRY_TIMES; /* otherwise, the transaction may not be aborted */ \
+}
+
/* Modify context structure constructor, sans allocation */
void modify_init(modify_context *mc,struct backentry *old_entry)
{
@@ -405,7 +411,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
LDAPDebug( LDAP_DEBUG_ANY, "id2entry_add failed, err=%d %s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ MOD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
ec_in_cache = 1;
@@ -419,7 +425,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
LDAPDebug( LDAP_DEBUG_ANY, "index_add_mods failed, err=%d %s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ MOD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
/*
@@ -439,7 +445,8 @@ ldbm_back_modify( Slapi_PBlock *pb )
"vlv_update_index failed, err=%d %s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ MOD_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
@@ -455,7 +462,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
}
if (cache_replace( &inst->inst_cache, e, ec ) != 0 ) {
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ MOD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
@@ -515,9 +522,9 @@ error_return:
disk_full = 1;
}
- if (disk_full)
+ if (disk_full) {
rc= return_on_disk_full(li);
- else if (ldap_result_code != LDAP_SUCCESS) {
+ } else if (ldap_result_code != LDAP_SUCCESS) {
if (retry_count > 0) {
/* It is safer not to abort when the transaction is not started. */
dblayer_txn_abort(li,&txn); /* abort crashes in case disk full */
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 1873478..b88d964 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -52,6 +52,12 @@ static int moddn_rename_children(back_txn *ptxn, Slapi_PBlock *pb,
backend *be,
static int modrdn_rename_entry_update_indexes(back_txn *ptxn, Slapi_PBlock *pb, struct
ldbminfo *li, struct backentry *e, struct backentry *ec, Slapi_Mods *smods1, Slapi_Mods
*smods2, Slapi_Mods *smods3);
static void mods_remove_nsuniqueid(Slapi_Mods *smods);
+#define MOD_SET_ERROR(rc, error, count) \
+{ \
+ (rc) = (error); \
+ (count) = RETRY_TIMES; /* otherwise, the transaction may not be aborted */ \
+}
+
int
ldbm_back_modrdn( Slapi_PBlock *pb )
{
@@ -634,7 +640,8 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
LDAPDebug( LDAP_DEBUG_TRACE, "modrdn_rename_entry_update_indexes failed, err=%d
%s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ MOD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
+ goto error_return;
}
/*
@@ -656,6 +663,9 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
char ebuf[ BUFSIZ ];
LDAPDebug( LDAP_DEBUG_ANY, "modrdn: rdn2typeval (%s) failed\n",
escape_string( rdns[i], ebuf ), 0, 0 );
+ if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
+ MOD_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
svp[0] = &sv;
@@ -663,21 +673,24 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
retval = index_addordel_values_sv( be, type, svp, NULL, ec->ep_id, BE_INDEX_ADD,
&txn );
if (DB_LOCK_DEADLOCK == retval)
{
- /* Retry txn */
- continue;
+ /* To retry txn, once break "for loop" */
+ break;
}
- if (retval != 0 )
+ else if (retval != 0 )
{
LDAPDebug( LDAP_DEBUG_ANY, "modrdn: could not add new value to index, err=%d
%s\n",
retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
+ MOD_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
+ goto error_return;
}
}
slapi_ldap_value_free( rdns );
if (DB_LOCK_DEADLOCK == retval)
{
/* Retry txn */
- goto error_return;
+ continue;
}
}
}
@@ -690,13 +703,18 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
/* Retry txn */
continue;
}
- if (0 != retval)
+ else if (0 != retval)
{
- LDAPDebug( LDAP_DEBUG_TRACE, "moddn: could not update parent, err=%d
%s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+ LDAPDebug( LDAP_DEBUG_ANY, "modrdn: "
+ "could not update parent, err=%d %s\n", retval,
+ (msg = dblayer_strerror( retval )) ? msg : "", 0 );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
+ MOD_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
+ goto error_return;
}
/* Push out the db modifications from the new parent entry */
- if(retval==0)
+ else if(retval==0)
{
retval = modify_update_all(be, pb, &newparent_modify_context, &txn);
if (DB_LOCK_DEADLOCK == retval)
@@ -706,8 +724,14 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
}
if (0 != retval)
{
- LDAPDebug( LDAP_DEBUG_TRACE, "moddn: could not update parent, err=%d
%s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+ LDAPDebug( LDAP_DEBUG_TRACE, "modrdn: "
+ "could not update parent, err=%d %s\n", retval,
+ (msg = dblayer_strerror( retval )) ? msg : "",
+ 0 );
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
+ MOD_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
+ goto error_return;
}
}
}
@@ -721,6 +745,8 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
if (retval == DB_LOCK_DEADLOCK) continue;
if (retval == DB_RUNRECOVERY || LDBM_OS_ERR_IS_DISKFULL(retval))
disk_full = 1;
+ MOD_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
}
@@ -741,6 +767,8 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
{
if (retval == DB_RUNRECOVERY || LDBM_OS_ERR_IS_DISKFULL(retval))
disk_full = 1;
+ MOD_SET_ERROR(ldap_result_code,
+ LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}
@@ -769,7 +797,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
if (0 != retval)
{
if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
- ldap_result_code= LDAP_OPERATIONS_ERROR;
+ MOD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
goto error_return;
}