mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
ITS#8102 syncrepl: only use trylock on the cn=config DB
This commit is contained in:
parent
ebb4b82fcf
commit
62ecd38bc4
1 changed files with 14 additions and 5 deletions
|
|
@ -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 ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue