mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-30 19:49:35 -05:00
Protect operation when abandoning
This commit is contained in:
parent
07401e5829
commit
db939eeb86
1 changed files with 6 additions and 8 deletions
|
|
@ -610,7 +610,7 @@ operation_abandon( LloadOperation *op )
|
|||
|
||||
ldap_pvt_thread_mutex_lock( &op->o_link_mutex );
|
||||
c = op->o_upstream;
|
||||
if ( !c ) {
|
||||
if ( !c || !c->c_live ) {
|
||||
ldap_pvt_thread_mutex_unlock( &op->o_link_mutex );
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -640,6 +640,8 @@ operation_abandon( LloadOperation *op )
|
|||
}
|
||||
c->c_n_ops_executing--;
|
||||
b = (LloadBackend *)c->c_private;
|
||||
|
||||
op->o_upstream_refcnt++;
|
||||
CONNECTION_UNLOCK_INCREF(c);
|
||||
|
||||
ldap_pvt_thread_mutex_lock( &b->b_mutex );
|
||||
|
|
@ -652,14 +654,10 @@ operation_abandon( LloadOperation *op )
|
|||
}
|
||||
|
||||
CONNECTION_LOCK_DECREF(c);
|
||||
op->o_upstream_refcnt--;
|
||||
|
||||
unlock:
|
||||
/*
|
||||
* FIXME: the dance in operation_destroy_from_upstream might be slower than
|
||||
* optimal as we've done some of the things above already. However, we want
|
||||
* to clear o_upstream from the op if it's dying, but witnessing and
|
||||
* navigating the race to do that safely is too complex to copy here.
|
||||
*/
|
||||
if ( !c->c_live ) {
|
||||
if ( !c->c_live || !op->o_upstream_refcnt ) {
|
||||
operation_destroy_from_upstream( op );
|
||||
}
|
||||
if ( rc ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue