Commit 62a806b2 authored by Ondřej Kuzník's avatar Ondřej Kuzník
Browse files

Thread error checking

parent 1328777a
......@@ -35,7 +35,7 @@ upstream_connect_cb( evutil_socket_t s, short what, void *arg )
int error = 0, rc = -1;
epoch_t epoch;
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
Debug( LDAP_DEBUG_CONNS, "upstream_connect_cb: "
"fd=%d connection callback for backend uri='%s'\n",
s, b->b_uri.bv_val );
......@@ -55,7 +55,7 @@ upstream_connect_cb( evutil_socket_t s, short what, void *arg )
goto done;
}
if ( error == EINTR || error == EINPROGRESS || error == EWOULDBLOCK ) {
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
epoch_leave( epoch );
return;
} else if ( error ) {
......@@ -88,7 +88,7 @@ done:
backend_retry( b );
}
preempted:
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
event_free( conn->event );
ch_free( conn );
......@@ -108,12 +108,12 @@ upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg )
return;
}
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
/* We were already running when backend_reset tried to cancel us, but were
* already stuck waiting for the mutex, nothing to do and b_opening has
* been decremented as well */
if ( b->b_dns_req == NULL ) {
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
return;
}
b->b_dns_req = NULL;
......@@ -182,7 +182,7 @@ upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg )
goto fail;
}
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
evutil_freeaddrinfo( res );
epoch_leave( epoch );
return;
......@@ -194,7 +194,7 @@ fail:
b->b_opening--;
b->b_failed++;
backend_retry( b );
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
if ( res ) {
evutil_freeaddrinfo( res );
}
......@@ -206,9 +206,9 @@ backend_select( LloadOperation *op, int *res )
{
LloadBackend *b, *first, *next;
ldap_pvt_thread_mutex_lock( &backend_mutex );
checked_lock( &backend_mutex );
first = b = current_backend;
ldap_pvt_thread_mutex_unlock( &backend_mutex );
checked_unlock( &backend_mutex );
*res = LDAP_UNAVAILABLE;
......@@ -222,14 +222,14 @@ backend_select( LloadOperation *op, int *res )
lload_c_head *head;
LloadConnection *c;
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
next = LDAP_CIRCLEQ_LOOP_NEXT( &backend, b, b_next );
if ( b->b_max_pending && b->b_n_ops_executing >= b->b_max_pending ) {
Debug( LDAP_DEBUG_CONNS, "backend_select: "
"backend %s too busy\n",
b->b_uri.bv_val );
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
b = next;
*res = LDAP_BUSY;
continue;
......@@ -249,7 +249,7 @@ backend_select( LloadOperation *op, int *res )
}
LDAP_CIRCLEQ_FOREACH ( c, head, c_next ) {
ldap_pvt_thread_mutex_lock( &c->c_io_mutex );
checked_lock( &c->c_io_mutex );
CONNECTION_LOCK(c);
if ( c->c_state == LLOAD_C_READY && !c->c_pendingber &&
( b->b_max_conn_pending == 0 ||
......@@ -269,9 +269,9 @@ backend_select( LloadOperation *op, int *res )
*/
LDAP_CIRCLEQ_MAKE_TAIL( head, c, c_next );
ldap_pvt_thread_mutex_lock( &backend_mutex );
checked_lock( &backend_mutex );
current_backend = next;
ldap_pvt_thread_mutex_unlock( &backend_mutex );
checked_unlock( &backend_mutex );
b->b_n_ops_executing++;
if ( op->o_tag == LDAP_REQ_BIND ) {
......@@ -282,14 +282,14 @@ backend_select( LloadOperation *op, int *res )
c->c_n_ops_executing++;
c->c_counters.lc_ops_received++;
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
*res = LDAP_SUCCESS;
return c;
}
CONNECTION_UNLOCK(c);
ldap_pvt_thread_mutex_unlock( &c->c_io_mutex );
checked_unlock( &c->c_io_mutex );
}
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
b = next;
} while ( b != first );
......@@ -370,7 +370,7 @@ backend_connect( evutil_socket_t s, short what, void *arg )
char *hostname;
epoch_t epoch;
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
assert( b->b_dns_req == NULL );
if ( b->b_cookie ) {
......@@ -381,7 +381,7 @@ backend_connect( evutil_socket_t s, short what, void *arg )
Debug( LDAP_DEBUG_CONNS, "backend_connect: "
"doing nothing, shutdown in progress\n" );
b->b_opening--;
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
return;
}
......@@ -452,7 +452,7 @@ backend_connect( evutil_socket_t s, short what, void *arg )
goto fail;
}
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
epoch_leave( epoch );
return;
}
......@@ -474,12 +474,12 @@ backend_connect( evutil_socket_t s, short what, void *arg )
*/
placeholder = (struct evdns_getaddrinfo_request *)&request;
b->b_dns_req = placeholder;
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
request = evdns_getaddrinfo(
dnsbase, hostname, NULL, &hints, upstream_name_cb, b );
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
assert( request || b->b_dns_req != placeholder );
/* Record the request, unless upstream_name_cb or another thread
......@@ -488,7 +488,7 @@ backend_connect( evutil_socket_t s, short what, void *arg )
if ( b->b_dns_req == placeholder ) {
b->b_dns_req = request;
}
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
epoch_leave( epoch );
return;
......@@ -496,7 +496,7 @@ fail:
b->b_opening--;
b->b_failed++;
backend_retry( b );
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
epoch_leave( epoch );
}
......@@ -538,9 +538,9 @@ backend_reset( LloadBackend *b, int gentle )
if ( b->b_retry_event &&
event_pending( b->b_retry_event, EV_TIMEOUT, NULL ) ) {
assert( b->b_failed );
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
event_del( b->b_retry_event );
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
b->b_opening--;
}
if ( b->b_dns_req ) {
......@@ -593,7 +593,7 @@ lload_backend_destroy( LloadBackend *b )
"destroying backend uri='%s', numconns=%d, numbindconns=%d\n",
b->b_uri.bv_val, b->b_numconns, b->b_numbindconns );
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
b->b_numconns = b->b_numbindconns = 0;
backend_reset( b, 0 );
......@@ -618,7 +618,7 @@ lload_backend_destroy( LloadBackend *b )
assert( rc == LDAP_SUCCESS );
}
#endif /* BALANCER_MODULE */
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
ldap_pvt_thread_mutex_destroy( &b->b_mutex );
if ( b->b_retry_event ) {
......
......@@ -331,16 +331,16 @@ request_bind( LloadConnection *client, LloadOperation *op )
CONNECTION_UNLOCK(client);
if ( pin ) {
ldap_pvt_thread_mutex_lock( &op->o_link_mutex );
checked_lock( &op->o_link_mutex );
upstream = op->o_upstream;
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex );
checked_unlock( &op->o_link_mutex );
if ( upstream ) {
ldap_pvt_thread_mutex_lock( &upstream->c_io_mutex );
checked_lock( &upstream->c_io_mutex );
CONNECTION_LOCK(upstream);
if ( !IS_ALIVE( upstream, c_live ) ) {
CONNECTION_UNLOCK(upstream);
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
checked_unlock( &upstream->c_io_mutex );
upstream = NULL;
}
}
......@@ -381,17 +381,17 @@ request_bind( LloadConnection *client, LloadOperation *op )
ber = upstream->c_pendingber;
if ( ber == NULL && (ber = ber_alloc()) == NULL ) {
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
checked_unlock( &upstream->c_io_mutex );
if ( !pin ) {
LloadBackend *b = upstream->c_private;
upstream->c_n_ops_executing--;
CONNECTION_UNLOCK(upstream);
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
b->b_n_ops_executing--;
operation_update_backend_counters( op, b );
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
} else {
CONNECTION_UNLOCK(upstream);
}
......@@ -416,13 +416,13 @@ request_bind( LloadConnection *client, LloadOperation *op )
pin = op->o_pin_id = 0;
}
} else if ( tag == LDAP_AUTH_SASL && !op->o_pin_id ) {
ldap_pvt_thread_mutex_lock( &lload_pin_mutex );
checked_lock( &lload_pin_mutex );
pin = op->o_pin_id = lload_next_pin++;
Debug( LDAP_DEBUG_CONNS, "request_bind: "
"client connid=%lu allocated pin=%lu linking it to upstream "
"connid=%lu\n",
op->o_client_connid, pin, upstream->c_connid );
ldap_pvt_thread_mutex_unlock( &lload_pin_mutex );
checked_unlock( &lload_pin_mutex );
}
op->o_upstream = upstream;
......@@ -436,19 +436,19 @@ request_bind( LloadConnection *client, LloadOperation *op )
LloadBackend *b = upstream->c_private;
upstream->c_n_ops_executing--;
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
checked_unlock( &upstream->c_io_mutex );
CONNECTION_UNLOCK(upstream);
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
b->b_n_ops_executing--;
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
assert( !IS_ALIVE( client, c_live ) );
ldap_pvt_thread_mutex_lock( &op->o_link_mutex );
checked_lock( &op->o_link_mutex );
if ( op->o_upstream ) {
op->o_upstream = NULL;
}
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex );
checked_unlock( &op->o_link_mutex );
rc = -1;
goto done;
}
......@@ -481,7 +481,7 @@ request_bind( LloadConnection *client, LloadOperation *op )
{
rc = client_bind( op, upstream, &binddn, tag, &auth );
}
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
checked_unlock( &upstream->c_io_mutex );
done:
......@@ -534,10 +534,10 @@ finish_sasl_bind(
CONNECTION_UNLOCK(upstream);
ldap_pvt_thread_mutex_lock( &upstream->c_io_mutex );
checked_lock( &upstream->c_io_mutex );
output = upstream->c_pendingber;
if ( output == NULL && (output = ber_alloc()) == NULL ) {
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
checked_unlock( &upstream->c_io_mutex );
CONNECTION_LOCK_DESTROY(upstream);
return -1;
}
......@@ -551,7 +551,7 @@ finish_sasl_bind(
/* Make sure noone flushes the buffer before we re-insert the operation */
CONNECTION_LOCK(upstream);
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
checked_unlock( &upstream->c_io_mutex );
op->o_upstream_msgid = msgid;
......@@ -612,9 +612,9 @@ handle_bind_response(
"connid=%lu, result=%d\n",
op->o_client_msgid, op->o_client_connid, result );
ldap_pvt_thread_mutex_lock( &op->o_link_mutex );
checked_lock( &op->o_link_mutex );
upstream = op->o_upstream;
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex );
checked_unlock( &op->o_link_mutex );
if ( !upstream ) {
return LDAP_SUCCESS;
}
......@@ -763,9 +763,9 @@ handle_whoami_response(
return -1;
}
ldap_pvt_thread_mutex_lock( &op->o_link_mutex );
checked_lock( &op->o_link_mutex );
upstream = op->o_upstream;
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex );
checked_unlock( &op->o_link_mutex );
if ( !upstream ) {
return LDAP_SUCCESS;
}
......@@ -868,9 +868,9 @@ handle_vc_bind_response(
if ( result == LDAP_PROTOCOL_ERROR ) {
LloadConnection *upstream;
ldap_pvt_thread_mutex_lock( &op->o_link_mutex );
checked_lock( &op->o_link_mutex );
upstream = op->o_upstream;
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex );
checked_unlock( &op->o_link_mutex );
if ( upstream ) {
LloadBackend *b;
......@@ -955,11 +955,11 @@ handle_vc_bind_response(
}
CONNECTION_UNLOCK(client);
ldap_pvt_thread_mutex_lock( &client->c_io_mutex );
checked_lock( &client->c_io_mutex );
output = client->c_pendingber;
if ( output == NULL && (output = ber_alloc()) == NULL ) {
rc = -1;
ldap_pvt_thread_mutex_unlock( &client->c_io_mutex );
checked_unlock( &client->c_io_mutex );
goto done;
}
client->c_pendingber = output;
......@@ -970,7 +970,7 @@ handle_vc_bind_response(
LDAP_TAG_SASL_RES_CREDS, BER_BV_OPTIONAL( &creds ),
LDAP_TAG_CONTROLS, BER_BV_OPTIONAL( &controls ) );
ldap_pvt_thread_mutex_unlock( &client->c_io_mutex );
checked_unlock( &client->c_io_mutex );
if ( rc >= 0 ) {
connection_write_cb( -1, 0, client );
rc = 0;
......
......@@ -112,19 +112,19 @@ request_process( LloadConnection *client, LloadOperation *op )
LloadBackend *b = upstream->c_private;
upstream->c_n_ops_executing--;
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
checked_unlock( &upstream->c_io_mutex );
CONNECTION_UNLOCK(upstream);
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
b->b_n_ops_executing--;
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
assert( !IS_ALIVE( client, c_live ) );
ldap_pvt_thread_mutex_lock( &op->o_link_mutex );
checked_lock( &op->o_link_mutex );
if ( op->o_upstream ) {
op->o_upstream = NULL;
}
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex );
checked_unlock( &op->o_link_mutex );
return -1;
}
......@@ -134,12 +134,12 @@ request_process( LloadConnection *client, LloadOperation *op )
upstream->c_n_ops_executing--;
CONNECTION_UNLOCK(upstream);
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
checked_unlock( &upstream->c_io_mutex );
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
b->b_n_ops_executing--;
operation_update_backend_counters( op, b );
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
Debug( LDAP_DEBUG_ANY, "request_process: "
"ber_alloc failed\n" );
......@@ -187,7 +187,7 @@ request_process( LloadConnection *client, LloadOperation *op )
op->o_tag, &op->o_request,
LDAP_TAG_CONTROLS, BER_BV_OPTIONAL( &op->o_ctrls ) );
}
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
checked_unlock( &upstream->c_io_mutex );
connection_write_cb( -1, 0, upstream );
return rc;
......@@ -303,9 +303,9 @@ client_tls_handshake_cb( evutil_socket_t s, short what, void *arg )
* Also before we try to read anything from the connection, it isn't
* permitted to Abandon a StartTLS exop per RFC4511 anyway.
*/
ldap_pvt_thread_mutex_lock( &c->c_io_mutex );
checked_lock( &c->c_io_mutex );
if ( c->c_pendingber ) {
ldap_pvt_thread_mutex_unlock( &c->c_io_mutex );
checked_unlock( &c->c_io_mutex );
connection_write_cb( s, what, arg );
if ( !IS_ALIVE( c, c_live ) ) {
......@@ -314,15 +314,15 @@ client_tls_handshake_cb( evutil_socket_t s, short what, void *arg )
/* Do we still have data pending? If so, connection_write_cb would
* already have arranged the write callback to trigger again */
ldap_pvt_thread_mutex_lock( &c->c_io_mutex );
checked_lock( &c->c_io_mutex );
if ( c->c_pendingber ) {
ldap_pvt_thread_mutex_unlock( &c->c_io_mutex );
checked_unlock( &c->c_io_mutex );
return;
}
}
rc = ldap_pvt_tls_accept( c->c_sb, LLOAD_TLS_CTX );
ldap_pvt_thread_mutex_unlock( &c->c_io_mutex );
checked_unlock( &c->c_io_mutex );
if ( rc < 0 ) {
goto fail;
}
......@@ -452,9 +452,9 @@ client_init(
/* We only register the write event when we have data pending */
event_add( c->c_read_event, c->c_read_timeout );
ldap_pvt_thread_mutex_lock( &clients_mutex );
checked_lock( &clients_mutex );
LDAP_CIRCLEQ_INSERT_TAIL( &clients, c, c_next );
ldap_pvt_thread_mutex_unlock( &clients_mutex );
checked_unlock( &clients_mutex );
CONNECTION_UNLOCK(c);
return c;
......@@ -536,9 +536,9 @@ client_unlink( LloadConnection *c )
}
if ( state != LLOAD_C_DYING ) {
ldap_pvt_thread_mutex_lock( &clients_mutex );
checked_lock( &clients_mutex );
LDAP_CIRCLEQ_REMOVE( &clients, c, c_next );
ldap_pvt_thread_mutex_unlock( &clients_mutex );
checked_unlock( &clients_mutex );
}
CONNECTION_LOCK(c);
......@@ -575,8 +575,8 @@ client_destroy( LloadConnection *c )
void
clients_destroy( int gentle )
{
ldap_pvt_thread_mutex_lock( &clients_mutex );
checked_lock( &clients_mutex );
connections_walk(
&clients_mutex, &clients, lload_connection_close, &gentle );
ldap_pvt_thread_mutex_unlock( &clients_mutex );
checked_unlock( &clients_mutex );
}
......@@ -101,9 +101,9 @@ handle_pdus( void *ctx, void *arg )
}
c->c_currentber = ber;
ldap_pvt_thread_mutex_lock( &c->c_io_mutex );
checked_lock( &c->c_io_mutex );
tag = ber_get_next( c->c_sb, &len, ber );
ldap_pvt_thread_mutex_unlock( &c->c_io_mutex );
checked_unlock( &c->c_io_mutex );
if ( tag != LDAP_TAG_MESSAGE ) {
int err = sock_errno();
......@@ -198,9 +198,9 @@ connection_read_cb( evutil_socket_t s, short what, void *arg )
}
c->c_currentber = ber;
ldap_pvt_thread_mutex_lock( &c->c_io_mutex );
checked_lock( &c->c_io_mutex );
tag = ber_get_next( c->c_sb, &len, ber );
ldap_pvt_thread_mutex_unlock( &c->c_io_mutex );
checked_unlock( &c->c_io_mutex );
if ( tag != LDAP_TAG_MESSAGE ) {
int err = sock_errno();
......@@ -295,7 +295,7 @@ connection_write_cb( evutil_socket_t s, short what, void *arg )
epoch = epoch_join();
ldap_pvt_thread_mutex_lock( &c->c_io_mutex );
checked_lock( &c->c_io_mutex );
Debug( LDAP_DEBUG_CONNS, "connection_write_cb: "
"have something to write to connection connid=%lu\n",
c->c_connid );
......@@ -306,7 +306,7 @@ connection_write_cb( evutil_socket_t s, short what, void *arg )
if ( err != EWOULDBLOCK && err != EAGAIN ) {
char ebuf[128];
ldap_pvt_thread_mutex_unlock( &c->c_io_mutex );
checked_unlock( &c->c_io_mutex );
Debug( LDAP_DEBUG_ANY, "connection_write_cb: "
"ber_flush on fd=%d failed errno=%d (%s)\n",
c->c_fd, err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
......@@ -317,7 +317,7 @@ connection_write_cb( evutil_socket_t s, short what, void *arg )
} else {
c->c_pendingber = NULL;
}
ldap_pvt_thread_mutex_unlock( &c->c_io_mutex );
checked_unlock( &c->c_io_mutex );
done:
RELEASE_REF( c, c_refcnt, c->c_destroy );
......@@ -418,12 +418,12 @@ connections_walk_last(
do {
int rc;
ldap_pvt_thread_mutex_unlock( cq_mutex );
checked_unlock( cq_mutex );
rc = cb( c, arg );
RELEASE_REF( c, c_refcnt, c->c_destroy );
ldap_pvt_thread_mutex_lock( cq_mutex );
checked_lock( cq_mutex );
if ( rc || LDAP_CIRCLEQ_EMPTY( cq ) ) {
break;
}
......
......@@ -1319,10 +1319,10 @@ lloadd_daemon( struct event_base *daemon_base )
return -1;
}
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
b->b_retry_event = event;
backend_retry( b );
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
}
}
......@@ -1354,10 +1354,10 @@ lloadd_daemon( struct event_base *daemon_base )
/* Mark upstream connections closing and prevent from opening new ones */
LDAP_CIRCLEQ_FOREACH ( b, &backend, b_next ) {
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
b->b_numconns = b->b_numbindconns = 0;
backend_reset( b, 1 );
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
}
/* Do the same for clients */
......@@ -1463,9 +1463,9 @@ lload_handle_backend_invalidation( LloadChange *change )
if ( !current_backend ) {
current_backend = b;
}
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
backend_retry( b );
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
return;
} else if ( change->type == LLOAD_CHANGE_DEL ) {
ldap_pvt_thread_pool_walk(
......@@ -1486,10 +1486,10 @@ lload_handle_backend_invalidation( LloadChange *change )
&connection_pool, handle_pdus, backend_conn_cb, b );
ldap_pvt_thread_pool_walk(
&connection_pool, upstream_bind, backend_conn_cb, b );
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
backend_reset( b, 0 );
backend_retry( b );
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
return;
}
......@@ -1602,9 +1602,9 @@ lload_handle_backend_invalidation( LloadChange *change )
assert( need_close == 0 );
if ( need_open ) {
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
backend_retry( b );
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
checked_unlock( &b->b_mutex );
}
}
}
......@@ -1700,10 +1700,10 @@ lload_handle_global_invalidation( LloadChange *change )
&connection_pool, upstream_bind, backend_conn_cb, NULL );
LDAP_CIRCLEQ_FOREACH ( b, &backend, b_next ) {
ldap_pvt_thread_mutex_lock( &b->b_mutex );
checked_lock( &b->b_mutex );
backend_reset( b, 0 );
backend_retry( b );