ITS#7628 fix back-mdb txn refcount

If multiple ops used the same opinfo the refcount wasn't being decremented
This commit is contained in:
Howard Chu 2013-06-23 19:13:52 -07:00
parent 7c6b599de6
commit 99e22a4366
10 changed files with 20 additions and 1 deletions

View File

@ -438,6 +438,8 @@ return_results:
if ( opinfo.moi_oe.oe_key ) { if ( opinfo.moi_oe.oe_key ) {
LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next ); LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next );
} }
} else {
moi->moi_ref--;
} }
if( success == LDAP_SUCCESS ) { if( success == LDAP_SUCCESS ) {

View File

@ -138,6 +138,8 @@ done:
if ( moi == &opinfo ) { if ( moi == &opinfo ) {
mdb_txn_reset( moi->moi_txn ); mdb_txn_reset( moi->moi_txn );
LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next ); LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next );
} else {
moi->moi_ref--;
} }
/* free entry and reader lock */ /* free entry and reader lock */
if( e != NULL ) { if( e != NULL ) {

View File

@ -130,6 +130,8 @@ done:
if ( moi == &opinfo ) { if ( moi == &opinfo ) {
mdb_txn_reset( moi->moi_txn ); mdb_txn_reset( moi->moi_txn );
LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next ); LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next );
} else {
moi->moi_ref--;
} }
/* free entry */ /* free entry */
if ( e != NULL ) { if ( e != NULL ) {

View File

@ -457,6 +457,8 @@ return_results:
if ( opinfo.moi_oe.oe_key ) { if ( opinfo.moi_oe.oe_key ) {
LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next ); LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next );
} }
} else {
moi->moi_ref--;
} }
send_ldap_result( op, rs ); send_ldap_result( op, rs );

View File

@ -505,7 +505,8 @@ mdb_opinfo_get( Operation *op, struct mdb_info *mdb, int rdonly, mdb_op_info **m
moi->moi_ref = 0; moi->moi_ref = 0;
} }
if ( renew ) { if ( renew ) {
mdb_txn_renew( moi->moi_txn ); rc = mdb_txn_renew( moi->moi_txn );
assert(!rc);
} }
moi->moi_ref++; moi->moi_ref++;
if ( *moip != moi ) if ( *moip != moi )

View File

@ -671,6 +671,8 @@ done:
if ( opinfo.moi_oe.oe_key ) { if ( opinfo.moi_oe.oe_key ) {
LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next ); LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next );
} }
} else {
moi->moi_ref--;
} }
if( e != NULL ) { if( e != NULL ) {

View File

@ -656,6 +656,8 @@ done:
if ( opinfo.moi_oe.oe_key ) { if ( opinfo.moi_oe.oe_key ) {
LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next ); LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next );
} }
} else {
moi->moi_ref--;
} }
if( preread_ctrl != NULL && (*preread_ctrl) != NULL ) { if( preread_ctrl != NULL && (*preread_ctrl) != NULL ) {

View File

@ -76,6 +76,8 @@ done:;
if ( moi == &opinfo ) { if ( moi == &opinfo ) {
mdb_txn_reset( moi->moi_txn ); mdb_txn_reset( moi->moi_txn );
LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next ); LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next );
} else {
moi->moi_ref--;
} }
return rc; return rc;
} }

View File

@ -142,6 +142,8 @@ done:
if ( moi == &opinfo ) { if ( moi == &opinfo ) {
mdb_txn_reset( moi->moi_txn ); mdb_txn_reset( moi->moi_txn );
LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next ); LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next );
} else {
moi->moi_ref--;
} }
if ( e ) if ( e )
mdb_entry_return( op, e ); mdb_entry_return( op, e );

View File

@ -1058,6 +1058,8 @@ done:
if ( moi == &opinfo ) { if ( moi == &opinfo ) {
mdb_txn_reset( moi->moi_txn ); mdb_txn_reset( moi->moi_txn );
LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next ); LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next );
} else {
moi->moi_ref--;
} }
if( rs->sr_v2ref ) { if( rs->sr_v2ref ) {
ber_bvarray_free( rs->sr_v2ref ); ber_bvarray_free( rs->sr_v2ref );