]> git.sur5r.net Git - openldap/commitdiff
ITS#6577 potential fix, found using valgrind/drd. please test.
authorHoward Chu <hyc@openldap.org>
Sun, 20 Jun 2010 21:28:04 +0000 (21:28 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 20 Jun 2010 21:28:04 +0000 (21:28 +0000)
servers/slapd/back-bdb/cache.c

index 5e0d7bfde3869fb8883e7006bd26ab9cd5e07a11..a2c3ca53fc0482dace98660289f127803bcd32d9 100644 (file)
@@ -482,17 +482,19 @@ bdb_cache_find_ndn(
                                *res = eip;
                                return rc;
                        }
-               } else if ( ei2->bei_state & CACHE_ENTRY_DELETED ) {
+               }
+               bdb_cache_entryinfo_lock( ei2 );
+               if ( ei2->bei_state & CACHE_ENTRY_DELETED ) {
                        /* In the midst of deleting? Give it a chance to
                         * complete.
                         */
+                       bdb_cache_entryinfo_unlock( ei2 );
                        bdb_cache_entryinfo_unlock( eip );
                        ldap_pvt_thread_yield();
                        bdb_cache_entryinfo_lock( eip );
                        *res = eip;
                        return DB_NOTFOUND;
                }
-               bdb_cache_entryinfo_lock( ei2 );
                bdb_cache_entryinfo_unlock( eip );
 
                eip = ei2;