From a6c4cf857838d5fc14597f65444ddd348b3fa88d Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 21 Nov 2007 14:51:55 +0000 Subject: [PATCH] ITS#5221 fix NO_KIDS/NO_GRANDKIDS flags on rename ops --- servers/slapd/back-bdb/cache.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 084a4080af..6f673dd9f6 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -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 ); @@ -1162,7 +1159,11 @@ bdb_cache_modrdn( } ber_dupbv( &ei->bei_rdn, &rdn ); pei->bei_ckids--; - if ( pei->bei_dkids ) pei->bei_dkids--; + if ( pei->bei_dkids ) { + pei->bei_dkids--; + if ( pei->bei_kids < 2 ) + pei->bei_state |= CACHE_ENTRY_NO_KIDS | CACHE_ENTRY_NO_GRANDKIDS; + } #endif if (!ein) { @@ -1175,6 +1176,9 @@ bdb_cache_modrdn( /* 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 */ -- 2.39.5