From 1413de3a0474e316d2128ed420a1ebfe0d2b64d8 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Fri, 5 Dec 2014 18:18:53 +0100 Subject: [PATCH] Fix SysV semaphores - repair mti_txnid. Similar to 443a7e40c4280cfd07cbf80c5de62ea072b136e3. --- libraries/liblmdb/mdb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 7a71e18a0d..a4f13e60f6 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -2573,9 +2573,17 @@ mdb_txn_renew0(MDB_txn *txn) if (ti) { if (LOCK_MUTEX(rc, env, MDB_MUTEX(env, w))) return rc; - +#ifdef MDB_USE_SYSV_SEM + meta = env->me_metas[ mdb_env_pick_meta(env) ]; + txn->mt_txnid = meta->mm_txnid; + /* Update mti_txnid like mdb_mutex_failed() would, + * in case last writer crashed before updating it. + */ + ti->mti_txnid = txn->mt_txnid; +#else txn->mt_txnid = ti->mti_txnid; meta = env->me_metas[txn->mt_txnid & 1]; +#endif } else { meta = env->me_metas[ mdb_env_pick_meta(env) ]; txn->mt_txnid = meta->mm_txnid; -- 2.39.5