From: Howard Chu Date: Mon, 2 Mar 2009 08:26:30 +0000 (+0000) Subject: ITS#5860 - NO_CACHE entries were not being counted when they were X-Git-Tag: ACLCHECK_0~769 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=288e99cb08af11cc1e7b7d2f627022c04c84a0d0;p=openldap ITS#5860 - NO_CACHE entries were not being counted when they were converted to regular cached entries (so the entry cache grew beyond the configured size) --- diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 4b5edcfac3..be1c7d73a3 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -809,7 +809,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; + int rc = 0, load = 0, added = 0; EntryInfo ei = { 0 }; ei.bei_id = id; @@ -905,7 +905,10 @@ load1: * loading it, i.e it is already cached or * another thread is currently loading it. */ - (*eip)->bei_state &= ~CACHE_ENTRY_NOT_CACHED; + if ( (*eip)->bei_state & CACHE_ENTRY_NOT_CACHED ) { + (*eip)->bei_state &= ~CACHE_ENTRY_NOT_CACHED; + added = 1; + } flag &= ~ID_NOCACHE; } @@ -933,6 +936,7 @@ 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 @@ -997,7 +1001,7 @@ load1: if ( rc == 0 ) { int purge = 0; - if ( load ) { + if ( added ) { ldap_pvt_thread_mutex_lock( &bdb->bi_cache.c_count_mutex ); if ( !( flag & ID_NOCACHE )) { bdb->bi_cache.c_cursize++;