/* 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 ) {
(*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. */
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;
* 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;