+ li->li_dbcache[i].dbc_dirty = 0;
+ if ( li->li_dbcache[i].dbc_refcnt != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( CACHE, INFO,
+ "ldbm_cache_flush_all: couldn't close db (%s), refcnt=%d\n",
+ li->li_dbcache[i].dbc_name, li->li_dbcache[i].dbc_refcnt,0);
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "refcnt = %d, couldn't close db (%s)\n",
+ li->li_dbcache[i].dbc_refcnt,
+ li->li_dbcache[i].dbc_name, 0 );
+#endif
+
+ } else {
+#ifdef NEW_LOGGING
+ LDAP_LOG( CACHE, DETAIL1,
+ "ldbm_cache_flush_all: ldbm closing db (%s)\n",
+ li->li_dbcache[i].dbc_name, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "ldbm closing db (%s)\n",
+ li->li_dbcache[i].dbc_name, 0, 0 );
+#endif
+
+ ldap_pvt_thread_cond_signal( &li->li_dbcache_cv );
+ ldbm_close( li->li_dbcache[i].dbc_db );
+ free( li->li_dbcache[i].dbc_name );
+ li->li_dbcache[i].dbc_name = NULL;
+ }
+ }
+ }
+ ldap_pvt_thread_mutex_unlock( &li->li_dbcache_mutex );
+}
+
+void
+ldbm_cache_sync( Backend *be )
+{
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+ int i;
+
+ ldap_pvt_thread_mutex_lock( &li->li_dbcache_mutex );
+ for ( i = 0; i < MAXDBCACHE; i++ ) {
+ if ( li->li_dbcache[i].dbc_name != NULL && li->li_dbcache[i].dbc_dirty ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG ( CACHE, DETAIL1, "ldbm_cache_sync: "
+ "ldbm syncing db (%s)\n", li->li_dbcache[i].dbc_name, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "ldbm syncing db (%s)\n",
+ li->li_dbcache[i].dbc_name, 0, 0 );
+#endif
+ ldbm_sync( li->li_dbcache[i].dbc_db );
+ li->li_dbcache[i].dbc_dirty = 0;