Fix spurious lock messages from slapcat

This commit is contained in:
Howard Chu 2003-11-25 10:31:10 +00:00
parent 4eee5c8595
commit 2bfb0bdeb8

View File

@ -140,6 +140,8 @@ bdb_cache_entry_db_unlock
#else #else
int rc; int rc;
if ( !lock ) return 0;
rc = LOCK_PUT ( env, lock ); rc = LOCK_PUT ( env, lock );
return rc; return rc;
#endif #endif
@ -489,7 +491,13 @@ bdb_cache_lru_add(
EntryInfo *ei EntryInfo *ei
) )
{ {
DB_LOCK lock; DB_LOCK lock, *lockp;
if ( locker ) {
lockp = &lock;
} else {
lockp = NULL;
}
/* See if we're above the cache size limit */ /* See if we're above the cache size limit */
if ( bdb->bi_cache.c_cursize > bdb->bi_cache.c_maxsize ) { if ( bdb->bi_cache.c_cursize > bdb->bi_cache.c_maxsize ) {
@ -507,20 +515,20 @@ bdb_cache_lru_add(
* the object is idle. * the object is idle.
*/ */
if ( bdb_cache_entry_db_lock( bdb->bi_dbenv, locker, elru, 1, 1, if ( bdb_cache_entry_db_lock( bdb->bi_dbenv, locker, elru, 1, 1,
&lock ) == 0 ) { lockp ) == 0 ) {
/* If there's no entry, or this node is in /* If there's no entry, or this node is in
* the process of linking into the cache, * the process of linking into the cache,
* skip it. * skip it.
*/ */
if ( !elru->bei_e || (elru->bei_state & CACHE_ENTRY_NOT_LINKED) ) { if ( !elru->bei_e || (elru->bei_state & CACHE_ENTRY_NOT_LINKED) ) {
bdb_cache_entry_db_unlock( bdb->bi_dbenv, &lock ); bdb_cache_entry_db_unlock( bdb->bi_dbenv, lockp );
continue; continue;
} }
LRU_DELETE( &bdb->bi_cache, elru ); LRU_DELETE( &bdb->bi_cache, elru );
elru->bei_e->e_private = NULL; elru->bei_e->e_private = NULL;
bdb_entry_return( elru->bei_e ); bdb_entry_return( elru->bei_e );
elru->bei_e = NULL; elru->bei_e = NULL;
bdb_cache_entry_db_unlock( bdb->bi_dbenv, &lock ); bdb_cache_entry_db_unlock( bdb->bi_dbenv, lockp );
--bdb->bi_cache.c_cursize; --bdb->bi_cache.c_cursize;
if (bdb->bi_cache.c_cursize < bdb->bi_cache.c_maxsize) if (bdb->bi_cache.c_cursize < bdb->bi_cache.c_maxsize)
break; break;