From: Pierangelo Masarati Date: Sat, 10 Jun 2006 01:08:45 +0000 (+0000) Subject: make sure heavy concurrency doesn't cause quarantine loops X-Git-Tag: OPENLDAP_REL_ENG_2_4_3ALPHA~9^2~159 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=50c6a95a62df64cbd8367c974bd27eefda46a1e6;p=openldap make sure heavy concurrency doesn't cause quarantine loops --- diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index fd51c670a0..ca304aa165 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -846,8 +846,14 @@ ldap_back_quarantine( ldap_pvt_thread_mutex_lock( &li->li_quarantine_mutex ); if ( rs->sr_err == LDAP_UNAVAILABLE ) { + time_t new_last = slap_get_time(); + switch ( li->li_isquarantined ) { case LDAP_BACK_FQ_NO: + if ( ri->ri_last == new_last ) { + goto done; + } + Debug( LDAP_DEBUG_ANY, "%s: ldap_back_quarantine enter.\n", op->o_log_prefix, 0, 0 ); @@ -875,7 +881,7 @@ ldap_back_quarantine( } li->li_isquarantined = LDAP_BACK_FQ_YES; - ri->ri_last = slap_get_time(); + ri->ri_last = new_last; } else if ( li->li_isquarantined != LDAP_BACK_FQ_NO ) { Debug( LDAP_DEBUG_ANY, @@ -891,6 +897,7 @@ ldap_back_quarantine( li->li_isquarantined = LDAP_BACK_FQ_NO; } +done:; ldap_pvt_thread_mutex_unlock( &li->li_quarantine_mutex ); } diff --git a/servers/slapd/back-meta/conn.c b/servers/slapd/back-meta/conn.c index cfd61ec816..0f61ab2e21 100644 --- a/servers/slapd/back-meta/conn.c +++ b/servers/slapd/back-meta/conn.c @@ -496,7 +496,7 @@ retry:; goto error_return; } - /* copy the DN idf needed */ + /* copy the DN if needed */ if ( msc->msc_bound_ndn.bv_val == op->o_conn->c_dn.bv_val ) { ber_dupbv( &msc->msc_bound_ndn, &op->o_conn->c_dn ); } @@ -1396,8 +1396,14 @@ meta_back_quarantine( ldap_pvt_thread_mutex_lock( &mt->mt_quarantine_mutex ); if ( rs->sr_err == LDAP_UNAVAILABLE ) { + time_t new_last = slap_get_time(); + switch ( mt->mt_isquarantined ) { case LDAP_BACK_FQ_NO: + if ( ri->ri_last == new_last ) { + goto done; + } + Debug( LDAP_DEBUG_ANY, "%s meta_back_quarantine[%d]: enter.\n", op->o_log_prefix, candidate, 0 ); @@ -1431,7 +1437,7 @@ meta_back_quarantine( } mt->mt_isquarantined = LDAP_BACK_FQ_YES; - ri->ri_last = slap_get_time(); + ri->ri_last = new_last; } else if ( mt->mt_isquarantined == LDAP_BACK_FQ_RETRYING ) { Debug( LDAP_DEBUG_ANY, @@ -1448,6 +1454,7 @@ meta_back_quarantine( mt->mt_isquarantined = LDAP_BACK_FQ_NO; } +done:; ldap_pvt_thread_mutex_unlock( &mt->mt_quarantine_mutex ); }