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 ) ...@@ -35,7 +35,7 @@ upstream_connect_cb( evutil_socket_t s, short what, void *arg )
int error = 0, rc = -1; int error = 0, rc = -1;
epoch_t epoch; epoch_t epoch;
ldap_pvt_thread_mutex_lock( &b->b_mutex ); checked_lock( &b->b_mutex );
Debug( LDAP_DEBUG_CONNS, "upstream_connect_cb: " Debug( LDAP_DEBUG_CONNS, "upstream_connect_cb: "
"fd=%d connection callback for backend uri='%s'\n", "fd=%d connection callback for backend uri='%s'\n",
s, b->b_uri.bv_val ); s, b->b_uri.bv_val );
...@@ -55,7 +55,7 @@ upstream_connect_cb( evutil_socket_t s, short what, void *arg ) ...@@ -55,7 +55,7 @@ upstream_connect_cb( evutil_socket_t s, short what, void *arg )
goto done; goto done;
} }
if ( error == EINTR || error == EINPROGRESS || error == EWOULDBLOCK ) { if ( error == EINTR || error == EINPROGRESS || error == EWOULDBLOCK ) {
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
epoch_leave( epoch ); epoch_leave( epoch );
return; return;
} else if ( error ) { } else if ( error ) {
...@@ -88,7 +88,7 @@ done: ...@@ -88,7 +88,7 @@ done:
backend_retry( b ); backend_retry( b );
} }
preempted: preempted:
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
event_free( conn->event ); event_free( conn->event );
ch_free( conn ); ch_free( conn );
...@@ -108,12 +108,12 @@ upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg ) ...@@ -108,12 +108,12 @@ upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg )
return; 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 /* 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 * already stuck waiting for the mutex, nothing to do and b_opening has
* been decremented as well */ * been decremented as well */
if ( b->b_dns_req == NULL ) { if ( b->b_dns_req == NULL ) {
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
return; return;
} }
b->b_dns_req = NULL; b->b_dns_req = NULL;
...@@ -182,7 +182,7 @@ upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg ) ...@@ -182,7 +182,7 @@ upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg )
goto fail; goto fail;
} }
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
evutil_freeaddrinfo( res ); evutil_freeaddrinfo( res );
epoch_leave( epoch ); epoch_leave( epoch );
return; return;
...@@ -194,7 +194,7 @@ fail: ...@@ -194,7 +194,7 @@ fail:
b->b_opening--; b->b_opening--;
b->b_failed++; b->b_failed++;
backend_retry( b ); backend_retry( b );
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
if ( res ) { if ( res ) {
evutil_freeaddrinfo( res ); evutil_freeaddrinfo( res );
} }
...@@ -206,9 +206,9 @@ backend_select( LloadOperation *op, int *res ) ...@@ -206,9 +206,9 @@ backend_select( LloadOperation *op, int *res )
{ {
LloadBackend *b, *first, *next; LloadBackend *b, *first, *next;
ldap_pvt_thread_mutex_lock( &backend_mutex ); checked_lock( &backend_mutex );
first = b = current_backend; first = b = current_backend;
ldap_pvt_thread_mutex_unlock( &backend_mutex ); checked_unlock( &backend_mutex );
*res = LDAP_UNAVAILABLE; *res = LDAP_UNAVAILABLE;
...@@ -222,14 +222,14 @@ backend_select( LloadOperation *op, int *res ) ...@@ -222,14 +222,14 @@ backend_select( LloadOperation *op, int *res )
lload_c_head *head; lload_c_head *head;
LloadConnection *c; LloadConnection *c;
ldap_pvt_thread_mutex_lock( &b->b_mutex ); checked_lock( &b->b_mutex );
next = LDAP_CIRCLEQ_LOOP_NEXT( &backend, b, b_next ); next = LDAP_CIRCLEQ_LOOP_NEXT( &backend, b, b_next );
if ( b->b_max_pending && b->b_n_ops_executing >= b->b_max_pending ) { if ( b->b_max_pending && b->b_n_ops_executing >= b->b_max_pending ) {
Debug( LDAP_DEBUG_CONNS, "backend_select: " Debug( LDAP_DEBUG_CONNS, "backend_select: "
"backend %s too busy\n", "backend %s too busy\n",
b->b_uri.bv_val ); b->b_uri.bv_val );
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
b = next; b = next;
*res = LDAP_BUSY; *res = LDAP_BUSY;
continue; continue;
...@@ -249,7 +249,7 @@ backend_select( LloadOperation *op, int *res ) ...@@ -249,7 +249,7 @@ backend_select( LloadOperation *op, int *res )
} }
LDAP_CIRCLEQ_FOREACH ( c, head, c_next ) { 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); CONNECTION_LOCK(c);
if ( c->c_state == LLOAD_C_READY && !c->c_pendingber && if ( c->c_state == LLOAD_C_READY && !c->c_pendingber &&
( b->b_max_conn_pending == 0 || ( b->b_max_conn_pending == 0 ||
...@@ -269,9 +269,9 @@ backend_select( LloadOperation *op, int *res ) ...@@ -269,9 +269,9 @@ backend_select( LloadOperation *op, int *res )
*/ */
LDAP_CIRCLEQ_MAKE_TAIL( head, c, c_next ); LDAP_CIRCLEQ_MAKE_TAIL( head, c, c_next );
ldap_pvt_thread_mutex_lock( &backend_mutex ); checked_lock( &backend_mutex );
current_backend = next; current_backend = next;
ldap_pvt_thread_mutex_unlock( &backend_mutex ); checked_unlock( &backend_mutex );
b->b_n_ops_executing++; b->b_n_ops_executing++;
if ( op->o_tag == LDAP_REQ_BIND ) { if ( op->o_tag == LDAP_REQ_BIND ) {
...@@ -282,14 +282,14 @@ backend_select( LloadOperation *op, int *res ) ...@@ -282,14 +282,14 @@ backend_select( LloadOperation *op, int *res )
c->c_n_ops_executing++; c->c_n_ops_executing++;
c->c_counters.lc_ops_received++; c->c_counters.lc_ops_received++;
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
*res = LDAP_SUCCESS; *res = LDAP_SUCCESS;
return c; return c;
} }
CONNECTION_UNLOCK(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; b = next;
} while ( b != first ); } while ( b != first );
...@@ -370,7 +370,7 @@ backend_connect( evutil_socket_t s, short what, void *arg ) ...@@ -370,7 +370,7 @@ backend_connect( evutil_socket_t s, short what, void *arg )
char *hostname; char *hostname;
epoch_t epoch; epoch_t epoch;
ldap_pvt_thread_mutex_lock( &b->b_mutex ); checked_lock( &b->b_mutex );
assert( b->b_dns_req == NULL ); assert( b->b_dns_req == NULL );
if ( b->b_cookie ) { if ( b->b_cookie ) {
...@@ -381,7 +381,7 @@ backend_connect( evutil_socket_t s, short what, void *arg ) ...@@ -381,7 +381,7 @@ backend_connect( evutil_socket_t s, short what, void *arg )
Debug( LDAP_DEBUG_CONNS, "backend_connect: " Debug( LDAP_DEBUG_CONNS, "backend_connect: "
"doing nothing, shutdown in progress\n" ); "doing nothing, shutdown in progress\n" );
b->b_opening--; b->b_opening--;
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
return; return;
} }
...@@ -452,7 +452,7 @@ backend_connect( evutil_socket_t s, short what, void *arg ) ...@@ -452,7 +452,7 @@ backend_connect( evutil_socket_t s, short what, void *arg )
goto fail; goto fail;
} }
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
epoch_leave( epoch ); epoch_leave( epoch );
return; return;
} }
...@@ -474,12 +474,12 @@ backend_connect( evutil_socket_t s, short what, void *arg ) ...@@ -474,12 +474,12 @@ backend_connect( evutil_socket_t s, short what, void *arg )
*/ */
placeholder = (struct evdns_getaddrinfo_request *)&request; placeholder = (struct evdns_getaddrinfo_request *)&request;
b->b_dns_req = placeholder; b->b_dns_req = placeholder;
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
request = evdns_getaddrinfo( request = evdns_getaddrinfo(
dnsbase, hostname, NULL, &hints, upstream_name_cb, b ); 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 ); assert( request || b->b_dns_req != placeholder );
/* Record the request, unless upstream_name_cb or another thread /* Record the request, unless upstream_name_cb or another thread
...@@ -488,7 +488,7 @@ backend_connect( evutil_socket_t s, short what, void *arg ) ...@@ -488,7 +488,7 @@ backend_connect( evutil_socket_t s, short what, void *arg )
if ( b->b_dns_req == placeholder ) { if ( b->b_dns_req == placeholder ) {
b->b_dns_req = request; b->b_dns_req = request;
} }
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
epoch_leave( epoch ); epoch_leave( epoch );
return; return;
...@@ -496,7 +496,7 @@ fail: ...@@ -496,7 +496,7 @@ fail:
b->b_opening--; b->b_opening--;
b->b_failed++; b->b_failed++;
backend_retry( b ); backend_retry( b );
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
epoch_leave( epoch ); epoch_leave( epoch );
} }
...@@ -538,9 +538,9 @@ backend_reset( LloadBackend *b, int gentle ) ...@@ -538,9 +538,9 @@ backend_reset( LloadBackend *b, int gentle )
if ( b->b_retry_event && if ( b->b_retry_event &&
event_pending( b->b_retry_event, EV_TIMEOUT, NULL ) ) { event_pending( b->b_retry_event, EV_TIMEOUT, NULL ) ) {
assert( b->b_failed ); assert( b->b_failed );
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
event_del( b->b_retry_event ); event_del( b->b_retry_event );
ldap_pvt_thread_mutex_lock( &b->b_mutex ); checked_lock( &b->b_mutex );
b->b_opening--; b->b_opening--;
} }
if ( b->b_dns_req ) { if ( b->b_dns_req ) {
...@@ -593,7 +593,7 @@ lload_backend_destroy( LloadBackend *b ) ...@@ -593,7 +593,7 @@ lload_backend_destroy( LloadBackend *b )
"destroying backend uri='%s', numconns=%d, numbindconns=%d\n", "destroying backend uri='%s', numconns=%d, numbindconns=%d\n",
b->b_uri.bv_val, b->b_numconns, b->b_numbindconns ); 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; b->b_numconns = b->b_numbindconns = 0;
backend_reset( b, 0 ); backend_reset( b, 0 );
...@@ -618,7 +618,7 @@ lload_backend_destroy( LloadBackend *b ) ...@@ -618,7 +618,7 @@ lload_backend_destroy( LloadBackend *b )
assert( rc == LDAP_SUCCESS ); assert( rc == LDAP_SUCCESS );
} }
#endif /* BALANCER_MODULE */ #endif /* BALANCER_MODULE */
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
ldap_pvt_thread_mutex_destroy( &b->b_mutex ); ldap_pvt_thread_mutex_destroy( &b->b_mutex );
if ( b->b_retry_event ) { if ( b->b_retry_event ) {
......
...@@ -331,16 +331,16 @@ request_bind( LloadConnection *client, LloadOperation *op ) ...@@ -331,16 +331,16 @@ request_bind( LloadConnection *client, LloadOperation *op )
CONNECTION_UNLOCK(client); CONNECTION_UNLOCK(client);
if ( pin ) { if ( pin ) {
ldap_pvt_thread_mutex_lock( &op->o_link_mutex ); checked_lock( &op->o_link_mutex );
upstream = op->o_upstream; upstream = op->o_upstream;
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex ); checked_unlock( &op->o_link_mutex );
if ( upstream ) { if ( upstream ) {
ldap_pvt_thread_mutex_lock( &upstream->c_io_mutex ); checked_lock( &upstream->c_io_mutex );
CONNECTION_LOCK(upstream); CONNECTION_LOCK(upstream);
if ( !IS_ALIVE( upstream, c_live ) ) { if ( !IS_ALIVE( upstream, c_live ) ) {
CONNECTION_UNLOCK(upstream); CONNECTION_UNLOCK(upstream);
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex ); checked_unlock( &upstream->c_io_mutex );
upstream = NULL; upstream = NULL;
} }
} }
...@@ -381,17 +381,17 @@ request_bind( LloadConnection *client, LloadOperation *op ) ...@@ -381,17 +381,17 @@ request_bind( LloadConnection *client, LloadOperation *op )
ber = upstream->c_pendingber; ber = upstream->c_pendingber;
if ( ber == NULL && (ber = ber_alloc()) == NULL ) { if ( ber == NULL && (ber = ber_alloc()) == NULL ) {
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex ); checked_unlock( &upstream->c_io_mutex );
if ( !pin ) { if ( !pin ) {
LloadBackend *b = upstream->c_private; LloadBackend *b = upstream->c_private;
upstream->c_n_ops_executing--; upstream->c_n_ops_executing--;
CONNECTION_UNLOCK(upstream); CONNECTION_UNLOCK(upstream);
ldap_pvt_thread_mutex_lock( &b->b_mutex ); checked_lock( &b->b_mutex );
b->b_n_ops_executing--; b->b_n_ops_executing--;
operation_update_backend_counters( op, b ); operation_update_backend_counters( op, b );
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
} else { } else {
CONNECTION_UNLOCK(upstream); CONNECTION_UNLOCK(upstream);
} }
...@@ -416,13 +416,13 @@ request_bind( LloadConnection *client, LloadOperation *op ) ...@@ -416,13 +416,13 @@ request_bind( LloadConnection *client, LloadOperation *op )
pin = op->o_pin_id = 0; pin = op->o_pin_id = 0;
} }
} else if ( tag == LDAP_AUTH_SASL && !op->o_pin_id ) { } 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++; pin = op->o_pin_id = lload_next_pin++;
Debug( LDAP_DEBUG_CONNS, "request_bind: " Debug( LDAP_DEBUG_CONNS, "request_bind: "
"client connid=%lu allocated pin=%lu linking it to upstream " "client connid=%lu allocated pin=%lu linking it to upstream "
"connid=%lu\n", "connid=%lu\n",
op->o_client_connid, pin, upstream->c_connid ); 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; op->o_upstream = upstream;
...@@ -436,19 +436,19 @@ request_bind( LloadConnection *client, LloadOperation *op ) ...@@ -436,19 +436,19 @@ request_bind( LloadConnection *client, LloadOperation *op )
LloadBackend *b = upstream->c_private; LloadBackend *b = upstream->c_private;
upstream->c_n_ops_executing--; upstream->c_n_ops_executing--;
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex ); checked_unlock( &upstream->c_io_mutex );
CONNECTION_UNLOCK(upstream); CONNECTION_UNLOCK(upstream);
ldap_pvt_thread_mutex_lock( &b->b_mutex ); checked_lock( &b->b_mutex );
b->b_n_ops_executing--; b->b_n_ops_executing--;
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
assert( !IS_ALIVE( client, c_live ) ); 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 ) { if ( op->o_upstream ) {
op->o_upstream = NULL; op->o_upstream = NULL;
} }
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex ); checked_unlock( &op->o_link_mutex );
rc = -1; rc = -1;
goto done; goto done;
} }
...@@ -481,7 +481,7 @@ request_bind( LloadConnection *client, LloadOperation *op ) ...@@ -481,7 +481,7 @@ request_bind( LloadConnection *client, LloadOperation *op )
{ {
rc = client_bind( op, upstream, &binddn, tag, &auth ); rc = client_bind( op, upstream, &binddn, tag, &auth );
} }
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex ); checked_unlock( &upstream->c_io_mutex );
done: done:
...@@ -534,10 +534,10 @@ finish_sasl_bind( ...@@ -534,10 +534,10 @@ finish_sasl_bind(
CONNECTION_UNLOCK(upstream); CONNECTION_UNLOCK(upstream);
ldap_pvt_thread_mutex_lock( &upstream->c_io_mutex ); checked_lock( &upstream->c_io_mutex );
output = upstream->c_pendingber; output = upstream->c_pendingber;
if ( output == NULL && (output = ber_alloc()) == NULL ) { 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); CONNECTION_LOCK_DESTROY(upstream);
return -1; return -1;
} }
...@@ -551,7 +551,7 @@ finish_sasl_bind( ...@@ -551,7 +551,7 @@ finish_sasl_bind(
/* Make sure noone flushes the buffer before we re-insert the operation */ /* Make sure noone flushes the buffer before we re-insert the operation */
CONNECTION_LOCK(upstream); CONNECTION_LOCK(upstream);
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex ); checked_unlock( &upstream->c_io_mutex );
op->o_upstream_msgid = msgid; op->o_upstream_msgid = msgid;
...@@ -612,9 +612,9 @@ handle_bind_response( ...@@ -612,9 +612,9 @@ handle_bind_response(
"connid=%lu, result=%d\n", "connid=%lu, result=%d\n",
op->o_client_msgid, op->o_client_connid, result ); 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; upstream = op->o_upstream;
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex ); checked_unlock( &op->o_link_mutex );
if ( !upstream ) { if ( !upstream ) {
return LDAP_SUCCESS; return LDAP_SUCCESS;
} }
...@@ -763,9 +763,9 @@ handle_whoami_response( ...@@ -763,9 +763,9 @@ handle_whoami_response(
return -1; return -1;
} }
ldap_pvt_thread_mutex_lock( &op->o_link_mutex ); checked_lock( &op->o_link_mutex );
upstream = op->o_upstream; upstream = op->o_upstream;
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex ); checked_unlock( &op->o_link_mutex );
if ( !upstream ) { if ( !upstream ) {
return LDAP_SUCCESS; return LDAP_SUCCESS;
} }
...@@ -868,9 +868,9 @@ handle_vc_bind_response( ...@@ -868,9 +868,9 @@ handle_vc_bind_response(
if ( result == LDAP_PROTOCOL_ERROR ) { if ( result == LDAP_PROTOCOL_ERROR ) {
LloadConnection *upstream; LloadConnection *upstream;
ldap_pvt_thread_mutex_lock( &op->o_link_mutex ); checked_lock( &op->o_link_mutex );
upstream = op->o_upstream; upstream = op->o_upstream;
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex ); checked_unlock( &op->o_link_mutex );
if ( upstream ) { if ( upstream ) {
LloadBackend *b; LloadBackend *b;
...@@ -955,11 +955,11 @@ handle_vc_bind_response( ...@@ -955,11 +955,11 @@ handle_vc_bind_response(
} }
CONNECTION_UNLOCK(client); CONNECTION_UNLOCK(client);
ldap_pvt_thread_mutex_lock( &client->c_io_mutex ); checked_lock( &client->c_io_mutex );
output = client->c_pendingber; output = client->c_pendingber;
if ( output == NULL && (output = ber_alloc()) == NULL ) { if ( output == NULL && (output = ber_alloc()) == NULL ) {
rc = -1; rc = -1;
ldap_pvt_thread_mutex_unlock( &client->c_io_mutex ); checked_unlock( &client->c_io_mutex );
goto done; goto done;
} }
client->c_pendingber = output; client->c_pendingber = output;
...@@ -970,7 +970,7 @@ handle_vc_bind_response( ...@@ -970,7 +970,7 @@ handle_vc_bind_response(
LDAP_TAG_SASL_RES_CREDS, BER_BV_OPTIONAL( &creds ), LDAP_TAG_SASL_RES_CREDS, BER_BV_OPTIONAL( &creds ),
LDAP_TAG_CONTROLS, BER_BV_OPTIONAL( &controls ) ); 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 ) { if ( rc >= 0 ) {
connection_write_cb( -1, 0, client ); connection_write_cb( -1, 0, client );
rc = 0; rc = 0;
......
...@@ -112,19 +112,19 @@ request_process( LloadConnection *client, LloadOperation *op ) ...@@ -112,19 +112,19 @@ request_process( LloadConnection *client, LloadOperation *op )
LloadBackend *b = upstream->c_private; LloadBackend *b = upstream->c_private;
upstream->c_n_ops_executing--; upstream->c_n_ops_executing--;
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex ); checked_unlock( &upstream->c_io_mutex );
CONNECTION_UNLOCK(upstream); CONNECTION_UNLOCK(upstream);
ldap_pvt_thread_mutex_lock( &b->b_mutex ); checked_lock( &b->b_mutex );
b->b_n_ops_executing--; b->b_n_ops_executing--;
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); checked_unlock( &b->b_mutex );
assert( !IS_ALIVE( client, c_live ) ); 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 ) { if ( op->o_upstream ) {
op->o_upstream = NULL; op->o_upstream = NULL;
} }
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex ); checked_unlock( &op->o_link_mutex );
return -1; return -1;
} }
...@@ -134,12 +134,12 @@ request_process( LloadConnection *client, LloadOperation *op ) ...@@ -134,12 +134,12 @@ request_process( LloadConnection *client, LloadOperation *op )
upstream->c_n_ops_executing--; upstream->c_n_ops_executing--;
CONNECTION_UNLOCK(upstream); 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--;