]> git.sur5r.net Git - openldap/commitdiff
ITS#7256 A few issues discovered during testing slapmodify.
authorOndrej Kuznik <ondrej.kuznik@acision.com>
Mon, 23 Apr 2012 14:58:20 +0000 (16:58 +0200)
committerHoward Chu <hyc@openldap.org>
Wed, 9 Jul 2014 00:28:12 +0000 (17:28 -0700)
- bdb deallocates cursor after some tool operations but expects it to be
  around every time it is called
- mdb tries to allocate a second transaction while it already holds one,
  deadlocking
- op->o_hdr must exist for most uses of op, but o_tmpmfuncs need not
- what about indexing after a tool modify? Does it happen automatically?

servers/slapd/back-bdb/tools.c
servers/slapd/back-mdb/id2entry.c

index 91facca824085710812bb1ca01f3b0283a80771d..c0ce3a2cf80cb82f0947cff5826dd895cd880574 100644 (file)
@@ -747,6 +747,15 @@ done:
                e->e_id = NOID;
        }
 
+       if ( cursor == NULL )
+       {
+               int rc = bdb->bi_id2entry->bdi_db->cursor(
+                       bdb->bi_id2entry->bdi_db, bdb->bi_cache.c_txn, &cursor,
+                       bdb->bi_db_opflags );
+               if ( rc != 0 )
+                       e->e_id = NOID;
+       }
+
        return e->e_id;
 }
 
@@ -982,6 +991,15 @@ done:
                e->e_id = NOID;
        }
 
+       if ( cursor == NULL )
+       {
+               int rc = bdb->bi_id2entry->bdi_db->cursor(
+                       bdb->bi_id2entry->bdi_db, bdb->bi_cache.c_txn, &cursor,
+                       bdb->bi_db_opflags );
+               if ( rc != 0 )
+                       e->e_id = NOID;
+       }
+
        return e->e_id;
 }
 
index 77a25a6daa0e12775f8cdf42ffb5aea784a8effb..a4306181471298221877111cc32b8a1ea404d86d 100644 (file)
@@ -245,7 +245,7 @@ int mdb_entry_return(
        if ( !e )
                return 0;
        if ( e->e_private ) {
-               if ( op->o_hdr ) {
+               if ( op->o_hdr && op->o_tmpmfuncs ) {
                        op->o_tmpfree( e->e_nname.bv_val, op->o_tmpmemctx );
                        op->o_tmpfree( e->e_name.bv_val, op->o_tmpmemctx );
                        op->o_tmpfree( e, op->o_tmpmemctx );