From 5d600468011aaf773cf4cd7ed13a213d3e2e72ca Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 26 Aug 2011 01:24:06 -0700 Subject: [PATCH] fix opinfo --- servers/slapd/back-mdb/bind.c | 10 ++-------- servers/slapd/back-mdb/compare.c | 10 ++-------- servers/slapd/back-mdb/operational.c | 10 ++-------- servers/slapd/back-mdb/referral.c | 10 ++-------- servers/slapd/back-mdb/search.c | 10 ++-------- 5 files changed, 10 insertions(+), 40 deletions(-) diff --git a/servers/slapd/back-mdb/bind.c b/servers/slapd/back-mdb/bind.c index 95f017fc23..fe34954632 100644 --- a/servers/slapd/back-mdb/bind.c +++ b/servers/slapd/back-mdb/bind.c @@ -135,15 +135,9 @@ mdb_bind( Operation *op, SlapReply *rs ) } done: - moi->moi_ref--; - if ( moi->moi_ref < 1 ) { - if ( moi->moi_flag & MOI_READER ) { - mdb_txn_reset( moi->moi_txn ); - } /* writers can abort themselves */ + if ( moi == &opinfo ) { + mdb_txn_reset( moi->moi_txn ); LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next ); - if ( moi->moi_flag & MOI_FREEIT ) { - op->o_tmpfree( moi, op->o_tmpmemctx ); - } } /* free entry and reader lock */ if( e != NULL ) { diff --git a/servers/slapd/back-mdb/compare.c b/servers/slapd/back-mdb/compare.c index 2b2ddfb981..89ca4d4f31 100644 --- a/servers/slapd/back-mdb/compare.c +++ b/servers/slapd/back-mdb/compare.c @@ -123,15 +123,9 @@ return_results: } done: - moi->moi_ref--; - if ( moi->moi_ref < 1 ) { - if ( moi->moi_flag & MOI_READER ) { - mdb_txn_reset( moi->moi_txn ); - } /* writers can abort themselves */ + if ( moi == &opinfo ) { + mdb_txn_reset( moi->moi_txn ); LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next ); - if ( moi->moi_flag & MOI_FREEIT ) { - op->o_tmpfree( moi, op->o_tmpmemctx ); - } } /* free entry */ if ( e != NULL ) { diff --git a/servers/slapd/back-mdb/operational.c b/servers/slapd/back-mdb/operational.c index d6c16665e0..28f6e7b4aa 100644 --- a/servers/slapd/back-mdb/operational.c +++ b/servers/slapd/back-mdb/operational.c @@ -73,15 +73,9 @@ mdb_hasSubordinates( } done:; - moi->moi_ref--; - if ( moi->moi_ref < 1 ) { - if ( moi->moi_flag & MOI_READER ) { - mdb_txn_reset( moi->moi_txn ); - } /* writers can abort themselves */ + if ( moi == &opinfo ) { + mdb_txn_reset( moi->moi_txn ); LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next ); - if ( moi->moi_flag & MOI_FREEIT ) { - op->o_tmpfree( moi, op->o_tmpmemctx ); - } } return rc; } diff --git a/servers/slapd/back-mdb/referral.c b/servers/slapd/back-mdb/referral.c index 08fb00391a..be74c48492 100644 --- a/servers/slapd/back-mdb/referral.c +++ b/servers/slapd/back-mdb/referral.c @@ -139,15 +139,9 @@ mdb_referrals( Operation *op, SlapReply *rs ) } done: - moi->moi_ref--; - if ( moi->moi_ref < 1 ) { - if ( moi->moi_flag & MOI_READER ) { - mdb_txn_reset( moi->moi_txn ); - } /* writers can abort themselves */ + if ( moi == &opinfo ) { + mdb_txn_reset( moi->moi_txn ); LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next ); - if ( moi->moi_flag & MOI_FREEIT ) { - op->o_tmpfree( moi, op->o_tmpmemctx ); - } } if ( e ) mdb_entry_return( e ); diff --git a/servers/slapd/back-mdb/search.c b/servers/slapd/back-mdb/search.c index 52435884a3..efb0a7c6f1 100644 --- a/servers/slapd/back-mdb/search.c +++ b/servers/slapd/back-mdb/search.c @@ -815,15 +815,9 @@ nochange: rs->sr_err = LDAP_SUCCESS; done: - moi->moi_ref--; - if ( moi->moi_ref < 1 ) { - if ( moi->moi_flag & MOI_READER ) { - mdb_txn_reset( moi->moi_txn ); - } /* writers can abort themselves */ + if ( moi == &opinfo ) { + mdb_txn_reset( moi->moi_txn ); LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next ); - if ( moi->moi_flag & MOI_FREEIT ) { - op->o_tmpfree( moi, op->o_tmpmemctx ); - } } if( idcursor ) mdb_cursor_close( idcursor ); -- 2.39.2