Skip to content
Snippets Groups Projects
Commit 51330ebd authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

ITS#5221

Fix dn2id cache for back-hdb rename ops
parent 40936c6e
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ OpenLDAP 2.4.7 Engineering
Fixed slapd 3-way Multi-Master Replication (ITS#5238)
Fixed slapd hash collisions in index slots (ITS#5183)
Fixed slapd-bdb to report and fail on internal errors (ITS#5232)
Fixed slapd-hdb caching on rename ops (ITS#5221)
Fixed slapo-pcache op->o_abandon handling (ITS#5187)
Fixed slapo-ppolicy single password check on modify (ITS#5146)
Fixed slapo-ppolicy internal search (ITS#5235)
......
......@@ -1148,9 +1148,6 @@ bdb_cache_modrdn(
free( ei->bei_nrdn.bv_val );
ber_dupbv( &ei->bei_nrdn, nrdn );
if ( !pei->bei_kids )
pei->bei_state |= CACHE_ENTRY_NO_KIDS | CACHE_ENTRY_NO_GRANDKIDS;
#ifdef BDB_HIER
free( ei->bei_rdn.bv_val );
......@@ -1161,8 +1158,16 @@ bdb_cache_modrdn(
rdn.bv_len = ptr - rdn.bv_val;
}
ber_dupbv( &ei->bei_rdn, &rdn );
pei->bei_ckids--;
if ( pei->bei_dkids ) pei->bei_dkids--;
/* If new parent, decrement kid counts */
if ( ein ) {
pei->bei_ckids--;
if ( pei->bei_dkids ) {
pei->bei_dkids--;
if ( pei->bei_dkids < 2 )
pei->bei_state |= CACHE_ENTRY_NO_KIDS | CACHE_ENTRY_NO_GRANDKIDS;
}
}
#endif
if (!ein) {
......@@ -1171,27 +1176,32 @@ bdb_cache_modrdn(
ei->bei_parent = ein;
bdb_cache_entryinfo_unlock( pei );
bdb_cache_entryinfo_lock( ein );
}
/* parent now has kids */
if ( ein->bei_state & CACHE_ENTRY_NO_KIDS )
ein->bei_state ^= CACHE_ENTRY_NO_KIDS;
/* new parent now has kids */
if ( ein->bei_state & CACHE_ENTRY_NO_KIDS )
ein->bei_state ^= CACHE_ENTRY_NO_KIDS;
/* grandparent has grandkids */
if ( ein->bei_parent )
ein->bei_parent->bei_state &= ~CACHE_ENTRY_NO_GRANDKIDS;
#ifdef BDB_HIER
/* parent might now have grandkids */
if ( ein->bei_state & CACHE_ENTRY_NO_GRANDKIDS &&
!(ei->bei_state & (CACHE_ENTRY_NO_KIDS)))
ein->bei_state ^= CACHE_ENTRY_NO_GRANDKIDS;
/* parent might now have grandkids */
if ( ein->bei_state & CACHE_ENTRY_NO_GRANDKIDS &&
!(ei->bei_state & CACHE_ENTRY_NO_KIDS))
ein->bei_state ^= CACHE_ENTRY_NO_GRANDKIDS;
{
/* Record the generation number of this change */
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 );
ein->bei_ckids++;
if ( ein->bei_dkids ) ein->bei_dkids++;
#endif
}
ein->bei_ckids++;
if ( ein->bei_dkids ) ein->bei_dkids++;
#ifdef BDB_HIER
/* Record the generation number of this change */
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 );
bdb_cache_entryinfo_unlock( ein );
return rc;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment