From: Howard Chu Date: Sat, 7 Jul 2012 00:38:03 +0000 (-0700) Subject: Fix: avoid direct reference to meta pages X-Git-Tag: OPENLDAP_REL_ENG_2_4_32~61^2~7 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=433105f09b33b28065a06185f628b4b38e0c4c22;p=openldap Fix: avoid direct reference to meta pages Relevant info should be copied during txn_begin only. --- diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index c32057c8a1..0c8e6aa0e5 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -1608,9 +1608,9 @@ mdb_txn_renew0(MDB_txn *txn) txn->mt_u.dirty_list[0].mid = 0; txn->mt_free_pgs = env->me_free_pgs; txn->mt_free_pgs[0] = 0; - txn->mt_next_pgno = env->me_metas[txn->mt_toggle]->mm_last_pg+1; env->me_txn = txn; } + txn->mt_next_pgno = env->me_metas[txn->mt_toggle]->mm_last_pg+1; /* Copy the DB arrays */ LAZY_RWLOCK_RDLOCK(&env->me_dblock); @@ -3380,7 +3380,7 @@ mdb_page_get(MDB_txn *txn, pgno_t pgno, MDB_page **ret) } } if (!p) { - if (pgno <= txn->mt_env->me_metas[txn->mt_toggle]->mm_last_pg) + if (pgno < txn->mt_next_pgno) p = (MDB_page *)(txn->mt_env->me_map + txn->mt_env->me_psize * pgno); } *ret = p;