]> git.sur5r.net Git - openldap/commitdiff
ITS#7628 fix back-mdb txn refcount
authorHoward Chu <hyc@openldap.org>
Mon, 24 Jun 2013 02:13:52 +0000 (19:13 -0700)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 1 Jul 2013 22:11:41 +0000 (15:11 -0700)
If multiple ops used the same opinfo the refcount wasn't being decremented

servers/slapd/back-mdb/add.c
servers/slapd/back-mdb/bind.c
servers/slapd/back-mdb/compare.c
servers/slapd/back-mdb/delete.c
servers/slapd/back-mdb/id2entry.c
servers/slapd/back-mdb/modify.c
servers/slapd/back-mdb/modrdn.c
servers/slapd/back-mdb/operational.c
servers/slapd/back-mdb/referral.c
servers/slapd/back-mdb/search.c

index 289eb321a272d4368d7c9c4543fd55e07ac462f6..1b70597149860c6bf214436296fd13de210be89e 100644 (file)
@@ -438,6 +438,8 @@ return_results:
                if ( opinfo.moi_oe.oe_key ) {
                        LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next );
                }
+       } else {
+               moi->moi_ref--;
        }
 
        if( success == LDAP_SUCCESS ) {
index 0cd716e71f5fc3c17312c877f2270ae1d03e98cd..1563723294b72e509938a96b0a741c5ae64753f6 100644 (file)
@@ -138,6 +138,8 @@ done:
        if ( moi == &opinfo ) {
                mdb_txn_reset( moi->moi_txn );
                LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next );
+       } else {
+               moi->moi_ref--;
        }
        /* free entry and reader lock */
        if( e != NULL ) {
index 3ea188fef2ee17bb3ff096c1c00e8cb5ab3b9920..81f583cf7e262373cc803a7819201e72e496396f 100644 (file)
@@ -130,6 +130,8 @@ done:
        if ( moi == &opinfo ) {
                mdb_txn_reset( moi->moi_txn );
                LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next );
+       } else {
+               moi->moi_ref--;
        }
        /* free entry */
        if ( e != NULL ) {
index 1735fee799c35d4d34e10aca6bda02c1fa3fb947..ac857395b2687d54580bab37af07b889e82e6a43 100644 (file)
@@ -457,6 +457,8 @@ return_results:
                if ( opinfo.moi_oe.oe_key ) {
                        LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next );
                }
+       } else {
+               moi->moi_ref--;
        }
 
        send_ldap_result( op, rs );
index 84de09d125f77963dd78522fda8850934e3cc673..a86a25ce7eb32749cf5ce45d891cd3567b307b7d 100644 (file)
@@ -505,7 +505,8 @@ mdb_opinfo_get( Operation *op, struct mdb_info *mdb, int rdonly, mdb_op_info **m
                moi->moi_ref = 0;
        }
        if ( renew ) {
-               mdb_txn_renew( moi->moi_txn );
+               rc = mdb_txn_renew( moi->moi_txn );
+               assert(!rc);
        }
        moi->moi_ref++;
        if ( *moip != moi )
index 1ea664f4fe9ef5e9c2c3be77b7c2e39261cc0f46..1a81e820a084b0fd612737f9b852f7669de0e6a3 100644 (file)
@@ -671,6 +671,8 @@ done:
                if ( opinfo.moi_oe.oe_key ) {
                        LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next );
                }
+       } else {
+               moi->moi_ref--;
        }
 
        if( e != NULL ) {
index f70457bdafc9201ea7b764436b192c6a9168e263..2aa545d2421dbdec5d7daeace1a22d083e47b548 100644 (file)
@@ -656,6 +656,8 @@ done:
                if ( opinfo.moi_oe.oe_key ) {
                        LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.moi_oe, OpExtra, oe_next );
                }
+       } else {
+               moi->moi_ref--;
        }
 
        if( preread_ctrl != NULL && (*preread_ctrl) != NULL ) {
index 4937984b7f345382121c71d50c2751bdc29e4a54..398df1271dc96e7547e56e14f58f15907f3c9700 100644 (file)
@@ -76,6 +76,8 @@ done:;
        if ( moi == &opinfo ) {
                mdb_txn_reset( moi->moi_txn );
                LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next );
+       } else {
+               moi->moi_ref--;
        }
        return rc;
 }
index c253f2ee0cd10e46d340b691b226bb1d6b18bbce..1325c442e7fead283720b9de576976463091f57d 100644 (file)
@@ -142,6 +142,8 @@ done:
        if ( moi == &opinfo ) {
                mdb_txn_reset( moi->moi_txn );
                LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next );
+       } else {
+               moi->moi_ref--;
        }
        if ( e )
                mdb_entry_return( op, e );
index 286d5e734eb516af3db310d1e33ecd6f4697bffc..5cc0d28c00b5f3d0ff91f081a06f6a461a6bf97e 100644 (file)
@@ -1058,6 +1058,8 @@ done:
        if ( moi == &opinfo ) {
                mdb_txn_reset( moi->moi_txn );
                LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next );
+       } else {
+               moi->moi_ref--;
        }
        if( rs->sr_v2ref ) {
                ber_bvarray_free( rs->sr_v2ref );