From 2bb9a15d576efa33dce00005675ac18122a0ee03 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 23 May 2003 02:04:03 +0000 Subject: [PATCH] ITS#2541 added bdb_cache_delete_cleanup() to defer cache delete. --- servers/slapd/back-bdb/cache.c | 12 ++++++++++-- servers/slapd/back-bdb/delete.c | 5 ++--- servers/slapd/back-bdb/proto-bdb.h | 4 ++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 7b78809cdc..ac229fa2d9 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -817,11 +817,19 @@ bdb_cache_delete( /* free cache write lock */ ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock ); bdb_cache_entryinfo_unlock( ei->bei_parent ); - bdb_cache_entryinfo_destroy( ei ); - e->e_private = NULL; return( rc ); } +void +bdb_cache_delete_cleanup( + Entry *e +) +{ + bdb_cache_entryinfo_destroy( e->e_private ); + e->e_private = NULL; + bdb_entry_return( e ); +} + static int bdb_cache_delete_internal( Cache *cache, diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index 3327e286e4..3f02961e4e 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -488,11 +488,9 @@ return_results: #if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC) if ( rs->sr_err == LDAP_SUCCESS && !noop ) { - BEI(e) = eip; LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) { bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_DELETE ); } - BEI(e) = NULL; } #endif @@ -506,7 +504,8 @@ done: /* free entry */ if( e != NULL ) { if ( rs->sr_err == LDAP_SUCCESS ) { - bdb_entry_return( e ); + /* Free the EntryInfo and the Entry */ + bdb_cache_delete_cleanup( e ); } else { bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e); } diff --git a/servers/slapd/back-bdb/proto-bdb.h b/servers/slapd/back-bdb/proto-bdb.h index 6d526f1cca..bbd31ece74 100644 --- a/servers/slapd/back-bdb/proto-bdb.h +++ b/servers/slapd/back-bdb/proto-bdb.h @@ -408,6 +408,7 @@ void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw ); #define bdb_cache_add BDB_SYMBOL(cache_add) #define bdb_cache_children BDB_SYMBOL(cache_children) #define bdb_cache_delete BDB_SYMBOL(cache_delete) +#define bdb_cache_delete_cleanup BDB_SYMBOL(cache_delete_cleanup) #define bdb_cache_find_id BDB_SYMBOL(cache_find_id) #define bdb_cache_find_ndn BDB_SYMBOL(cache_find_ndn) #define bdb_cache_modify BDB_SYMBOL(cache_modify) @@ -467,6 +468,9 @@ int bdb_cache_delete( u_int32_t locker, DB_LOCK *lock ); +void bdb_cache_delete_cleanup( + Entry *e +); void bdb_cache_release_all( Cache *cache ); #ifdef BDB_REUSE_LOCKERS -- 2.39.5