From fb583c30710debf0eb45c02159afbf3402774f23 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 8 Feb 2007 10:29:40 +0000 Subject: [PATCH] Revert prev commit --- servers/slapd/back-bdb/cache.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 06c4ba16ea..7f93b3bad1 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -837,7 +837,7 @@ load1: bdb_cache_entryinfo_unlock( *eip ); islocked = 0; } - rc = bdb_cache_entry_db_lock( bdb, locker, *eip, 0, 0, lock ); + rc = bdb_cache_entry_db_lock( bdb, locker, *eip, load, 0, lock ); if ( (*eip)->bei_state & CACHE_ENTRY_DELETED ) { rc = DB_NOTFOUND; bdb_cache_entry_db_unlock( bdb, lock ); @@ -858,8 +858,12 @@ load1: ep = NULL; bdb_cache_lru_link( bdb, *eip ); } - if ( rc ) { - /* On error, release the lock. */ + if ( rc == 0 ) { + /* If we succeeded, downgrade back to a readlock. */ + rc = bdb_cache_entry_db_relock( bdb, locker, + *eip, 0, 0, lock ); + } else { + /* Otherwise, release the lock. */ bdb_cache_entry_db_unlock( bdb, lock ); } } else if ( !(*eip)->bei_e ) { -- 2.39.5