ei.bei_id = e->e_id;
ei.bei_parent = eip;
ei.bei_nrdn = *nrdn;
+ ei.bei_lockpad = 0;
/* Lock this entry so that bdb_add can run to completion.
* It can only fail if BDB has run out of lock resources.
bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e);
e = NULL;
}
+ if( p != NULL ) {
+ bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p);
+ p = NULL;
+ }
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, DETAIL1,
"==> bdb_delete: retrying...\n", 0, 0, 0 );
goto done;
}
- bdb_cache_find_id( op, ltid, eip->bei_id, &eip, 0, locker, &plock );
+ rc = bdb_cache_find_id( op, ltid, eip->bei_id, &eip, 0, locker, &plock );
+ if ( rc ) {
+ switch( rc ) {
+ case DB_LOCK_DEADLOCK:
+ case DB_LOCK_NOTGRANTED:
+ goto retry;
+ }
+ rs->sr_err = LDAP_OTHER;
+ rs->sr_text = "internal error";
+ goto return_results;
+ }
if ( eip ) p = eip->bei_e;
if ( pdn.bv_len != 0 ) {
rs->sr_err = access_allowed( op, p,
children, NULL, ACL_WRITE, NULL );
- bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p);
- p = NULL;
-
if ( !rs->sr_err ) {
switch( opinfo.boi_err ) {
case DB_LOCK_DEADLOCK:
goto return_results;
}
- bdb_cache_find_id( op, lt2, eip->bei_id, &eip, 0, locker, &plock );
- if ( eip ) p = eip->bei_e;
if ( pdn.bv_len != 0 ) {
parent_is_glue = is_entry_glue(p);
rs->sr_err = bdb_cache_children( op, lt2, p );
}
done:
+ if ( p )
+ bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p);
+
/* free entry */
if( e != NULL ) {
if ( rs->sr_err == LDAP_SUCCESS ) {
DB_LOCK *lock )
{
EntryInfo *ei = NULL;
- int rc;
+ int rc, rc2;
#ifdef NEW_LOGGING
LDAP_LOG ( CACHE, ARGS, "bdb_dn2entry(\"%s\")\n", dn->bv_val, 0, 0 );
* or not.
*/
*e = ei;
- if ( ei && ei->bei_id )
- bdb_cache_find_id( op, tid, ei->bei_id,
+ if ( ei && ei->bei_id ) {
+ rc2 = bdb_cache_find_id( op, tid, ei->bei_id,
&ei, 1, locker, lock );
- else if ( ei )
+ if ( rc2 ) rc = rc2;
+ } else if ( ei )
bdb_cache_entryinfo_unlock( ei );
} else if ( ei ) {
bdb_cache_entryinfo_unlock( ei );
} else if ( matched && rc == DB_NOTFOUND ) {
/* always return EntryInfo */
ei = ei->bei_parent;
- bdb_cache_find_id( op, tid, ei->bei_id, &ei, 1,
+ rc2 = bdb_cache_find_id( op, tid, ei->bei_id, &ei, 1,
locker, lock );
+ if ( rc2 ) rc = rc2;
*e = ei;
}
}
goto return_results;
}
- bdb_cache_find_id( op, lt2, eip->bei_id, &eip, 0, locker, &plock );
- if ( eip ) p = eip->bei_e;
- if ( p_ndn.bv_len != 0 ) {
- parent_is_glue = is_entry_glue(p);
- rs->sr_err = bdb_cache_children( op, lt2, p );
- if ( rs->sr_err != DB_NOTFOUND ) {
- switch( rs->sr_err ) {
- case DB_LOCK_DEADLOCK:
- case DB_LOCK_NOTGRANTED:
- goto retry;
- case 0:
- break;
- default:
+ if ( p_ndn.bv_len != 0 ) {
+ parent_is_glue = is_entry_glue(p);
+ rs->sr_err = bdb_cache_children( op, lt2, p );
+ if ( rs->sr_err != DB_NOTFOUND ) {
+ switch( rs->sr_err ) {
+ case DB_LOCK_DEADLOCK:
+ case DB_LOCK_NOTGRANTED:
+ goto retry;
+ case 0:
+ break;
+ default:
#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ERR,
- "<=- bdb_modrdn: has_children failed %s (%d)\n",
- db_strerror(rs->sr_err), rs->sr_err, 0 );
+ LDAP_LOG ( OPERATION, ERR,
+ "<=- bdb_modrdn: has_children failed %s (%d)\n",
+ db_strerror(rs->sr_err), rs->sr_err, 0 );
#else
- Debug(LDAP_DEBUG_ARGS,
- "<=- bdb_modrdn: has_children failed: %s (%d)\n",
- db_strerror(rs->sr_err), rs->sr_err, 0 );
+ Debug(LDAP_DEBUG_ARGS,
+ "<=- bdb_modrdn: has_children failed: %s (%d)\n",
+ db_strerror(rs->sr_err), rs->sr_err, 0 );
#endif
- rs->sr_err = LDAP_OTHER;
- rs->sr_text = "internal error";
- goto return_results;
- }
- parent_is_leaf = 1;
- }
- bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p);
- p = NULL;
- }
+ rs->sr_err = LDAP_OTHER;
+ rs->sr_text = "internal error";
+ goto return_results;
+ }
+ parent_is_leaf = 1;
+ }
+ bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p);
+ p = NULL;
+ }
if ( TXN_COMMIT( lt2, 0 ) != 0 ) {
rs->sr_err = LDAP_OTHER;