From: Howard Chu Date: Mon, 26 Jan 2009 20:36:17 +0000 (+0000) Subject: More for ITS#5860 X-Git-Tag: ACLCHECK_0~944 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=09a369c4ea67e102033a002906cf24305efc2009;p=openldap More for ITS#5860 --- diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 89aea40a4e..747a1c1cc8 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -749,10 +749,13 @@ bdb_cache_lru_purge( struct bdb_info *bdb ) if ( islocked ) bdb_cache_entryinfo_unlock( elru ); - if ( (unsigned) count >= bdb->bi_cache.c_minfree && bdb->bi_cache.c_leaves <= eimax ) { - ldap_pvt_thread_mutex_lock( &bdb->bi_cache.c_count_mutex ); - bdb->bi_cache.c_cursize -= count; - ldap_pvt_thread_mutex_unlock( &bdb->bi_cache.c_count_mutex ); + if (( bdb->bi_cache.c_cursize < bdb->bi_cache.c_maxsize || + (unsigned) count >= bdb->bi_cache.c_minfree ) && bdb->bi_cache.c_leaves <= eimax ) { + if ( count ) { + ldap_pvt_thread_mutex_lock( &bdb->bi_cache.c_count_mutex ); + bdb->bi_cache.c_cursize -= count; + ldap_pvt_thread_mutex_unlock( &bdb->bi_cache.c_count_mutex ); + } break; } bottom: