From 9febe03eb595d72c1fe933b706559bf66789d1f0 Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@symas.com>
Date: Sat, 2 Aug 2014 10:33:35 -0700
Subject: [PATCH] More for MIPS

Paranoia for 3630066843b7ca6b2cd12911d3e2fe3314cd4549 do the
cacheflush before setting mti_txnid.
---
 libraries/liblmdb/mdb.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c
index 96f5772903..16f5855615 100644
--- a/libraries/liblmdb/mdb.c
+++ b/libraries/liblmdb/mdb.c
@@ -3581,6 +3581,10 @@ fail:
 		return rc;
 	}
 done:
+	/* MIPS has cache coherency issues, this is a no-op everywhere else */
+	if (!(env->me_flags & MDB_WRITEMAP)) {
+		CACHEFLUSH(env->me_map, txn->mt_next_pgno * env->me_psize, DCACHE);
+	}
 	/* Memory ordering issues are irrelevant; since the entire writer
 	 * is wrapped by wmutex, all of these changes will become visible
 	 * after the wmutex is unlocked. Since the DB is multi-version,
@@ -3590,11 +3594,6 @@ done:
 	if (env->me_txns)
 		env->me_txns->mti_txnid = txn->mt_txnid;
 
-	/* MIPS has cache coherency issues, this is a no-op everywhere else */
-	if (!(env->me_flags & MDB_WRITEMAP)) {
-		CACHEFLUSH(env->me_map, txn->mt_next_pgno * env->me_psize, DCACHE);
-	}
-
 	return MDB_SUCCESS;
 }
 
-- 
GitLab