From: Howard Chu Date: Fri, 19 Jun 2009 02:06:58 +0000 (+0000) Subject: ITS#6177 proposed fix, please test X-Git-Tag: ACLCHECK_0~489 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=68e252c9a9fcb2d5cf9f23753a8031e7504607d9;p=openldap ITS#6177 proposed fix, please test --- diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 5b79b665a2..e70e1b2f01 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -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 ) {