]> git.sur5r.net Git - openldap/commitdiff
More for ITS#5860
authorHoward Chu <hyc@openldap.org>
Mon, 26 Jan 2009 20:36:17 +0000 (20:36 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 26 Jan 2009 20:36:17 +0000 (20:36 +0000)
servers/slapd/back-bdb/cache.c

index 89aea40a4edb46e01f2c3a8d778e752001391155..747a1c1cc8e18e5f86e32d9c5716a10874172804 100644 (file)
@@ -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: