From: Howard Chu Date: Mon, 28 Apr 2008 11:17:52 +0000 (+0000) Subject: Fix delete deadlock X-Git-Tag: LOCKER_IDS~199 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a9d192df2b0573c123203399bc2b8d69727514f2;p=openldap Fix delete deadlock --- diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 065c6d25cb..f0ad3d217b 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -1257,18 +1257,19 @@ bdb_cache_delete( assert( e->e_private != NULL ); + /* Lock the entry's info */ + bdb_cache_entryinfo_lock( ei ); + /* Set this early, warn off any queriers */ ei->bei_state |= CACHE_ENTRY_DELETED; - /* Lock the entry's info */ - bdb_cache_entryinfo_lock( ei ); + bdb_cache_entryinfo_unlock( ei ); /* Get write lock on the data */ rc = bdb_cache_entry_db_relock( bdb, locker, ei, 1, 0, lock ); if ( rc ) { /* couldn't lock, undo and give up */ ei->bei_state ^= CACHE_ENTRY_DELETED; - bdb_cache_entryinfo_unlock( ei ); return rc; } @@ -1283,8 +1284,6 @@ bdb_cache_delete( /* free lru mutex */ ldap_pvt_thread_mutex_unlock( &bdb->bi_cache.c_lru_mutex ); - /* Leave entry info locked */ - return( rc ); } @@ -1293,6 +1292,8 @@ bdb_cache_delete_cleanup( Cache *cache, EntryInfo *ei ) { + bdb_cache_entryinfo_lock( ei ); + if ( ei->bei_e ) { ei->bei_e->e_private = NULL; #ifdef SLAP_ZONE_ALLOC