Commit 2d4f58bb authored by Howard Chu's avatar Howard Chu
Browse files

Make sure DB result codes are returned to caller; add missing retries to

callers of bdb_cache_find_id().
parent 3dedb083
......@@ -692,9 +692,11 @@ load1: if ( !(*eip)->bei_e && !((*eip)->bei_state & CACHE_ENTRY_LOADING)) {
/* Give up original read lock, obtain write lock with
* (possibly) new locker ID.
*/
bdb_cache_entry_db_relock( bdb->bi_dbenv, locker2,
*eip, 1, 0, lock );
if (!ep) {
if ( rc == 0 ) {
rc = bdb_cache_entry_db_relock( bdb->bi_dbenv, locker2,
*eip, 1, 0, lock );
}
if ( rc == 0 && !ep) {
rc = bdb_id2entry( op->o_bd, ltid, id, &ep );
}
if ( rc == 0 ) {
......@@ -708,7 +710,7 @@ load1: if ( !(*eip)->bei_e && !((*eip)->bei_state & CACHE_ENTRY_LOADING)) {
(*eip)->bei_state ^= CACHE_ENTRY_LOADING;
if ( rc == 0 ) {
/* If we succeeded, downgrade back to a readlock. */
bdb_cache_entry_db_relock( bdb->bi_dbenv, locker,
rc = bdb_cache_entry_db_relock( bdb->bi_dbenv, locker,
*eip, 0, 0, lock );
} else {
/* Otherwise, release the lock. */
......
......@@ -215,9 +215,12 @@ static int search_aliases(
ida = bdb_idl_next(curscop, &cursora))
{
ei = NULL;
retry1:
rs->sr_err = bdb_cache_find_id(op, NULL,
ida, &ei, 0, locker, &lockr );
if (rs->sr_err != LDAP_SUCCESS) {
if ( rs->sr_err == DB_LOCK_DEADLOCK ||
rs->sr_err == DB_LOCK_NOTGRANTED ) goto retry1;
continue;
}
a = ei->bei_e;
......@@ -281,9 +284,15 @@ nextido:
* Set the name so that the scope's IDL can be retrieved.
*/
ei = NULL;
sameido:
rs->sr_err = bdb_cache_find_id(op, NULL, ido, &ei,
0, locker, &locka );
if ( rs->sr_err != LDAP_SUCCESS ) goto nextido;
if ( rs->sr_err != LDAP_SUCCESS ) {
if ( rs->sr_err == DB_LOCK_DEADLOCK ||
rs->sr_err == DB_LOCK_NOTGRANTED )
goto sameido;
goto nextido;
}
e = ei->bei_e;
}
return rs->sr_err;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment