projects
/
platform
/
upstream
/
lmdb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a2ac101
)
Free write mutex earlier in txn_reset0
author
Howard Chu
<hyc@symas.com>
Wed, 16 Jul 2014 16:24:45 +0000
(09:24 -0700)
committer
Howard Chu
<hyc@symas.com>
Wed, 1 Oct 2014 19:36:11 +0000
(20:36 +0100)
libraries/liblmdb/mdb.c
patch
|
blob
|
history
diff --git
a/libraries/liblmdb/mdb.c
b/libraries/liblmdb/mdb.c
index 70c4de263a879a6485a0568dcaca43d2c1829131..b36f3b12819b850726d71c021a361fd807d7fff7 100644
(file)
--- a/
libraries/liblmdb/mdb.c
+++ b/
libraries/liblmdb/mdb.c
@@
-2798,12
+2798,26
@@
mdb_txn_reset0(MDB_txn *txn, const char *act)
txn->mt_numdbs = 0; /* close nothing if called again */
txn->mt_dbxs = NULL; /* mark txn as reset */
} else {
txn->mt_numdbs = 0; /* close nothing if called again */
txn->mt_dbxs = NULL; /* mark txn as reset */
} else {
+ pgno_t *pghead = env->me_pghead;
+ env->me_pghead = NULL;
+ env->me_pglast = 0;
+
+ if (!txn->mt_parent) {
+ if (mdb_midl_shrink(&txn->mt_free_pgs))
+ env->me_free_pgs = txn->mt_free_pgs;
+
+ env->me_txn = NULL;
+ /* The writer mutex was locked in mdb_txn_begin. */
+ if (env->me_txns)
+ UNLOCK_MUTEX(MDB_MUTEX(env, w));
+ }
+
mdb_cursors_close(txn, 0);
if (!(env->me_flags & MDB_WRITEMAP)) {
mdb_dlist_free(txn);
}
mdb_cursors_close(txn, 0);
if (!(env->me_flags & MDB_WRITEMAP)) {
mdb_dlist_free(txn);
}
- mdb_midl_free(
env->me_
pghead);
+ mdb_midl_free(pghead);
if (txn->mt_parent) {
txn->mt_parent->mt_child = NULL;
if (txn->mt_parent) {
txn->mt_parent->mt_child = NULL;
@@
-2811,18
+2825,7
@@
mdb_txn_reset0(MDB_txn *txn, const char *act)
mdb_midl_free(txn->mt_free_pgs);
mdb_midl_free(txn->mt_spill_pgs);
free(txn->mt_u.dirty_list);
mdb_midl_free(txn->mt_free_pgs);
mdb_midl_free(txn->mt_spill_pgs);
free(txn->mt_u.dirty_list);
- return;
}
}
-
- if (mdb_midl_shrink(&txn->mt_free_pgs))
- env->me_free_pgs = txn->mt_free_pgs;
- env->me_pghead = NULL;
- env->me_pglast = 0;
-
- env->me_txn = NULL;
- /* The writer mutex was locked in mdb_txn_begin. */
- if (env->me_txns)
- UNLOCK_MUTEX(MDB_MUTEX(env, w));
}
}
}
}