Commit 62ecd38b authored by Howard Chu's avatar Howard Chu
Browse files

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

parent ebb4b82f
......@@ -145,6 +145,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;
......@@ -1194,12 +1195,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;
}
......@@ -6969,6 +6976,8 @@ add_syncrepl(
ldap_pvt_thread_mutex_init( &si->si_monitor_mutex );
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 ) {
......
Supports Markdown
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