#define BDB_UPD_CONFIG 0x04
#define BDB_DEL_INDEX 0x08
#define BDB_RE_OPEN 0x10
+#ifdef BDB_HIER
+ int bi_modrdns; /* number of modrdns completed */
+ ldap_pvt_thread_mutex_t bi_modrdns_mutex;
+#endif
};
#define bi_id2entry bi_databases[BDB_ID2ENTRY]
*/
int
bdb_cache_modrdn(
+ struct bdb_info *bdb,
Entry *e,
struct berval *nrdn,
Entry *new,
EntryInfo *ein,
- DB_ENV *env,
u_int32_t locker,
DB_LOCK *lock )
{
int rc;
/* Get write lock on data */
- rc = bdb_cache_entry_db_relock( env, locker, ei, 1, 0, lock );
+ rc = bdb_cache_entry_db_relock( bdb->bi_dbenv, locker, ei, 1, 0, lock );
if ( rc ) return rc;
/* If we've done repeated mods on a cached entry, then e_attrs
}
#ifdef BDB_HIER
{
- int max = ei->bei_modrdns;
/* Record the generation number of this change */
- for ( pei = ein; pei->bei_parent; pei = pei->bei_parent ) {
- if ( pei->bei_modrdns > max ) max = pei->bei_modrdns;
- }
- ei->bei_modrdns = max + 1;
+ ldap_pvt_thread_mutex_lock( &bdb->bi_modrdns_mutex );
+ bdb->bi_modrdns++;
+ ei->bei_modrdns = bdb->bi_modrdns;
+ ldap_pvt_thread_mutex_unlock( &bdb->bi_modrdns_mutex );
}
#endif
avl_insert( &ein->bei_kids, ei, bdb_rdn_cmp, avl_dup_error );
ldap_pvt_thread_mutex_init( &bdb->bi_database_mutex );
ldap_pvt_thread_mutex_init( &bdb->bi_lastid_mutex );
+#ifdef BDB_HIER
+ ldap_pvt_thread_mutex_init( &bdb->bi_modrdns_mutex );
+#endif
ldap_pvt_thread_mutex_init( &bdb->bi_cache.lru_mutex );
ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_dntree.bei_kids_mutex );
ldap_pvt_thread_rdwr_init ( &bdb->bi_cache.c_rwlock );
ldap_pvt_thread_rdwr_destroy ( &bdb->bi_cache.c_rwlock );
ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.lru_mutex );
ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_dntree.bei_kids_mutex );
+#ifdef BDB_HIER
+ ldap_pvt_thread_mutex_destroy( &bdb->bi_modrdns_mutex );
+#endif
ldap_pvt_thread_mutex_destroy( &bdb->bi_lastid_mutex );
ldap_pvt_thread_mutex_destroy( &bdb->bi_database_mutex );
ldap_pvt_thread_rdwr_destroy( &bdb->bi_idl_tree_rwlock );
}
} else {
- rc = bdb_cache_modrdn( e, &op->orr_nnewrdn, &dummy, neip,
- bdb->bi_dbenv, locker, &lock );
+ rc = bdb_cache_modrdn( bdb, e, &op->orr_nnewrdn, &dummy, neip,
+ locker, &lock );
switch( rc ) {
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
u_int32_t locker
);
int bdb_cache_modrdn(
+ struct bdb_info *bdb,
Entry *e,
struct berval *nrdn,
Entry *new,
EntryInfo *ein,
- DB_ENV *env,
u_int32_t locker,
DB_LOCK *lock
);