]> git.sur5r.net Git - openldap/commitdiff
ITS#2759 - Fix LRU manipulation
authorHoward Chu <hyc@openldap.org>
Fri, 10 Oct 2003 01:16:34 +0000 (01:16 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 10 Oct 2003 01:16:34 +0000 (01:16 +0000)
servers/slapd/back-bdb/cache.c

index ad5498c29e40aaf00d81c7a22e798af33415b821..6dfb93e16fa9cdda70dd9a7ffa3cfdbe0eee4bdb 100644 (file)
@@ -823,9 +823,6 @@ try_again:
                        goto try_again;
                }
 
-               /* free cache read lock */
-               ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
-
                /* set lru mutex */
                ldap_pvt_thread_mutex_lock( &cache->lru_mutex );
 
@@ -836,6 +833,9 @@ try_again:
                /* free lru mutex */
                ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
 
+               /* free cache read lock */
+               ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
+
 #ifdef NEW_LOGGING
                LDAP_LOG( CACHE, DETAIL1, 
                        "bdb_cache_find_entry_dn2id: (%s): %ld %d tries\n",
@@ -955,8 +955,6 @@ try_again:
                /* Mark entry in-use */
                BEI(ep)->bei_refcnt++;
 
-               /* free cache read lock */
-               ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
                /* set lru mutex */
                ldap_pvt_thread_mutex_lock( &cache->lru_mutex );
                /* lru */
@@ -965,6 +963,8 @@ try_again:
 
                /* free lru mutex */
                ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
+               /* free cache read lock */
+               ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
 
 #ifdef NEW_LOGGING
                LDAP_LOG( CACHE, DETAIL1,