From 66e0d6017a0eab51337593be52d42dcba464afd9 Mon Sep 17 00:00:00 2001 From: Jorge Perez Burgos Date: Tue, 5 Nov 2013 10:12:41 +0100 Subject: [PATCH] ITS#7740 back-meta: avoid blocking other threads Don't lock other threads while trying to connect to remote node. --- servers/slapd/back-meta/bind.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/servers/slapd/back-meta/bind.c b/servers/slapd/back-meta/bind.c index f8f78bf318..058e9ec9fb 100644 --- a/servers/slapd/back-meta/bind.c +++ b/servers/slapd/back-meta/bind.c @@ -618,6 +618,10 @@ meta_back_single_dobind( /* FIXME: should we check if at least some of the op->o_ctrls * can/should be passed? */ + if(!dolock) { + ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex ); + } + for (;;) { rs->sr_err = ldap_sasl_bind( msc->msc_ld, binddn, LDAP_SASL_SIMPLE, &cred, @@ -628,6 +632,10 @@ meta_back_single_dobind( ldap_pvt_thread_yield(); } + if(!dolock) { + ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex ); + } + rs->sr_err = meta_back_bind_op_result( op, rs, mc, candidate, msgid, sendok, dolock ); /* if bind succeeded, but anonymous, clear msc_bound_ndn */ @@ -1578,6 +1586,11 @@ meta_back_proxy_authz_bind( switch ( method ) { case LDAP_AUTH_NONE: case LDAP_AUTH_SIMPLE: + + if(!dolock) { + ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex ); + } + for (;;) { rs->sr_err = ldap_sasl_bind( msc->msc_ld, binddn.bv_val, LDAP_SASL_SIMPLE, @@ -1587,6 +1600,11 @@ meta_back_proxy_authz_bind( } ldap_pvt_thread_yield(); } + + if(!dolock) { + ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex ); + } + rc = meta_back_bind_op_result( op, rs, mc, candidate, msgid, sendok, dolock ); if ( rc == LDAP_SUCCESS ) { /* set rebind stuff in case of successful proxyAuthz bind, -- 2.39.5