]> git.sur5r.net Git - openldap/commitdiff
More for ITS#6360
authorHoward Chu <hyc@openldap.org>
Wed, 4 Nov 2009 05:52:04 +0000 (05:52 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 4 Nov 2009 05:52:04 +0000 (05:52 +0000)
servers/slapd/back-bdb/cache.c

index bff580396e1cb07a7028008c40a83ac5dc3c685d..be80a22b2bd97b09990ca19014d94d147b8ce62d 100644 (file)
@@ -1072,23 +1072,18 @@ load1:
        if ( rc == 0 ) {
                int purge = 0;
 
-               if ( bdb->bi_cache.c_cursize > bdb->bi_cache.c_maxsize ||
-                       ( bdb->bi_cache.c_eimax && bdb->bi_cache.c_leaves > bdb->bi_cache.c_eimax )) {
-                       ldap_pvt_thread_mutex_lock( &bdb->bi_cache.c_count_mutex );
-                       if ( !bdb->bi_cache.c_purging ) {
-                               if ( load && !( flag & ID_NOCACHE )) {
-                                       bdb->bi_cache.c_cursize++;
-                                       if ( bdb->bi_cache.c_cursize > bdb->bi_cache.c_maxsize ) {
-                                               purge = 1;
-                                               bdb->bi_cache.c_purging = 1;
-                                       }
-                               } else if ( bdb->bi_cache.c_eimax && bdb->bi_cache.c_leaves > bdb->bi_cache.c_eimax ) {
-                                       purge = 1;
-                                       bdb->bi_cache.c_purging = 1;
-                               }
+               ldap_pvt_thread_mutex_lock( &bdb->bi_cache.c_count_mutex );
+               if ( load && !( flag & ID_NOCACHE )) {
+                       bdb->bi_cache.c_cursize++;
+                       if ( !bdb->bi_cache.c_purging && bdb->bi_cache.c_cursize > bdb->bi_cache.c_maxsize ) {
+                               purge = 1;
+                               bdb->bi_cache.c_purging = 1;
                        }
-                       ldap_pvt_thread_mutex_unlock( &bdb->bi_cache.c_count_mutex );
+               } else if ( !bdb->bi_cache.c_purging && bdb->bi_cache.c_eimax && bdb->bi_cache.c_leaves > bdb->bi_cache.c_eimax ) {
+                       purge = 1;
+                       bdb->bi_cache.c_purging = 1;
                }
+               ldap_pvt_thread_mutex_unlock( &bdb->bi_cache.c_count_mutex );
                if ( purge )
                        bdb_cache_lru_purge( bdb );
        }