Commit 584858eb authored by Howard Chu's avatar Howard Chu Committed by Quanah Gibson-Mount
Browse files

ITS#8102 syncrepl: only use trylock on the cn=config DB

parent 7e29c7f7
......@@ -124,6 +124,7 @@ typedef struct syncinfo_s {
int si_got;
int si_strict_refresh; /* stop listening during fallback refresh */
int si_too_old;
int si_is_configdb;
ber_int_t si_msgid;
Avlnode *si_presentlist;
LDAP *si_ld;
......@@ -974,12 +975,18 @@ get_pmutex(
syncinfo_t *si
)
{
while ( ldap_pvt_thread_mutex_trylock( &si->si_cookieState->cs_pmutex )) {
if ( slapd_shutdown )
return SYNC_SHUTDOWN;
if ( !ldap_pvt_thread_pool_pausecheck( &connection_pool ))
ldap_pvt_thread_yield();
if ( !si->si_is_configdb ) {
ldap_pvt_thread_mutex_lock( &si->si_cookieState->cs_pmutex );
} else {
/* avoid deadlock when replicating cn=config */
while ( ldap_pvt_thread_mutex_trylock( &si->si_cookieState->cs_pmutex )) {
if ( slapd_shutdown )
return SYNC_SHUTDOWN;
if ( !ldap_pvt_thread_pool_pausecheck( &connection_pool ))
ldap_pvt_thread_yield();
}
}
return 0;
}
......@@ -5641,6 +5648,8 @@ add_syncrepl(
LDAP_LIST_INIT( &si->si_nonpresentlist );
ldap_pvt_thread_mutex_init( &si->si_mutex );
si->si_is_configdb = strcmp( c->be->be_suffix[0].bv_val, "cn=config" ) == 0;
rc = parse_syncrepl_line( c, si );
if ( rc == 0 ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment