From: Howard Chu Date: Wed, 18 Mar 2009 08:52:38 +0000 (+0000) Subject: More for ITS#5860, always check cache sizes X-Git-Tag: ACLCHECK_0~670 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cc950c70d1d747ebb4e4b9ff39e9839d04854c30;p=openldap More for ITS#5860, always check cache sizes --- diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 7cd34038b1..b6dbaa651f 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -831,7 +831,7 @@ bdb_cache_find_id( { struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private; Entry *ep = NULL; - int rc = 0, load = 0, added = 0; + int rc = 0, load = 0; EntryInfo ei = { 0 }; ei.bei_id = id; @@ -929,7 +929,6 @@ load1: */ if ( (*eip)->bei_state & CACHE_ENTRY_NOT_CACHED ) { (*eip)->bei_state &= ~CACHE_ENTRY_NOT_CACHED; - added = 1; } flag &= ~ID_NOCACHE; } @@ -958,7 +957,6 @@ load1: #endif ep = NULL; bdb_cache_lru_link( bdb, *eip ); - added = 1; if (( flag & ID_NOCACHE ) && ( bdb_cache_entryinfo_trylock( *eip ) == 0 )) { /* Set the cached state only if no other thread @@ -1023,7 +1021,8 @@ load1: if ( rc == 0 ) { int purge = 0; - if ( added ) { + if ( bdb->bi_cache.c_cursize > bdb->bi_cache.c_maxsize || + bdb->bi_cache.c_leaves > bdb->bi_cache.c_eimax ) { ldap_pvt_thread_mutex_lock( &bdb->bi_cache.c_count_mutex ); if ( !( flag & ID_NOCACHE )) { bdb->bi_cache.c_cursize++;