]> git.sur5r.net Git - openldap/commitdiff
ITS#7971 LMDB: clarification in mdb_txn_renew0().
authorleo@yuriev.ru <leo@yuriev.ru>
Fri, 17 Oct 2014 22:46:53 +0000 (22:46 +0000)
committerHoward Chu <hyc@symas.com>
Sat, 18 Oct 2014 06:00:52 +0000 (07:00 +0100)
libraries/liblmdb/mdb.c

index 0af2047cff83511c0031542b97df7199dd87430c..b7b2ab3c06aa810e8461319f22fd42024ddea558 100644 (file)
@@ -2543,15 +2543,16 @@ mdb_txn_renew0(MDB_txn *txn)
                                        UNLOCK_MUTEX(rmutex);
                                        return MDB_READERS_FULL;
                                }
-                               ti->mti_readers[i].mr_pid = pid;
-                               ti->mti_readers[i].mr_tid = tid;
+                               r = &ti->mti_readers[i];
+                               r->mr_txnid = (txnid_t)-1;
+                               r->mr_tid = tid;
+                               r->mr_pid = pid; /* should be written last, see ITS#7971. */
                                if (i == nr)
                                        ti->mti_numreaders = ++nr;
                                /* Save numreaders for un-mutexed mdb_env_close() */
                                env->me_numreaders = nr;
                                UNLOCK_MUTEX(rmutex);
 
-                               r = &ti->mti_readers[i];
                                new_notls = (env->me_flags & MDB_NOTLS);
                                if (!new_notls && (rc=pthread_setspecific(env->me_txkey, r))) {
                                        r->mr_pid = 0;