]> git.sur5r.net Git - openldap/commitdiff
ITS#6177 proposed fix, please test
authorHoward Chu <hyc@openldap.org>
Fri, 19 Jun 2009 02:06:58 +0000 (02:06 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 19 Jun 2009 02:06:58 +0000 (02:06 +0000)
servers/slapd/back-bdb/cache.c

index 5b79b665a2aaba44d07dd41ce5c99b98f35f8422..e70e1b2f01befc21c583a1c268a889e027b112f2 100644 (file)
@@ -1336,7 +1336,7 @@ bdb_cache_delete(
     DB_LOCK    *lock )
 {
        EntryInfo *ei = BEI(e);
-       int     rc;
+       int     rc, busy = 0;
 
        assert( e->e_private != NULL );
 
@@ -1346,8 +1346,24 @@ bdb_cache_delete(
        /* Set this early, warn off any queriers */
        ei->bei_state |= CACHE_ENTRY_DELETED;
 
+       if (( ei->bei_state & ( CACHE_ENTRY_NOT_LINKED |
+               CACHE_ENTRY_LOADING | CACHE_ENTRY_ONELEVEL )) ||
+               ei->bei_finders > 0 )
+               busy = 1;
+
        bdb_cache_entryinfo_unlock( ei );
 
+       while ( busy ) {
+               ldap_pvt_thread_yield();
+               busy = 0;
+               bdb_cache_entryinfo_lock( ei );
+               if (( ei->bei_state & ( CACHE_ENTRY_NOT_LINKED |
+                       CACHE_ENTRY_LOADING | CACHE_ENTRY_ONELEVEL )) ||
+                       ei->bei_finders > 0 )
+                       busy = 1;
+               bdb_cache_entryinfo_unlock( ei );
+       }
+
        /* Get write lock on the data */
        rc = bdb_cache_entry_db_relock( bdb, txn, ei, 1, 0, lock );
        if ( rc ) {