]> git.sur5r.net Git - openldap/commitdiff
ITS#2541 added bdb_cache_delete_cleanup() to defer cache delete.
authorHoward Chu <hyc@openldap.org>
Fri, 23 May 2003 02:04:03 +0000 (02:04 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 23 May 2003 02:04:03 +0000 (02:04 +0000)
servers/slapd/back-bdb/cache.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/proto-bdb.h

index 7b78809cdc7837d0ceeb5f17cf14df465aadadb0..ac229fa2d9a6a2186c22ff94a0a3d2ee5a8ec0b6 100644 (file)
@@ -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,
index 3327e286e4b834d977372bd4662f0b7daf861bb0..3f02961e4e604ca89f2aa4f260764606c494e6b6 100644 (file)
@@ -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);
                }
index 6d526f1ccadd1d0e3043983833601d3373dd9200..bbd31ece7432ff69ac8a31f533fd0bc30dc0afd8 100644 (file)
@@ -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