From: Howard Chu Date: Sat, 10 Jul 2004 19:06:20 +0000 (+0000) Subject: Make sure DB result codes are returned to caller; add missing retries to X-Git-Tag: OPENDLAP_REL_ENG_2_2_MP~89 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2d4f58bbf692c694415ddfa31e0b2519e4415c40;p=openldap Make sure DB result codes are returned to caller; add missing retries to callers of bdb_cache_find_id(). --- diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 484efe3094..5fa9a20ab6 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -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. */ diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index 75ab32b2d4..a63a4bae99 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -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;