]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10521 LMDB: more for prev commit
authorHoward Chu <hyc@openldap.org>
Wed, 10 Jun 2026 19:42:09 +0000 (20:42 +0100)
committerHoward Chu <hyc@openldap.org>
Wed, 10 Jun 2026 19:42:25 +0000 (20:42 +0100)
libraries/liblmdb/mdb.c

index bd04edc1beebc3b268e4a662fc93dc0c28f081d9..7c099a2aa06ffbc2caf0534d9ecbda8ec350faf2 100644 (file)
@@ -3498,8 +3498,6 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret)
                 */
                if (parent->mt_flags & MDB_TXN_RDONLY)
                        return EINVAL;
-               if (parent->mt_flags & MDB_TXN_BLOCKED)
-                       return MDB_BAD_TXN;
                if ((parent->mt_flags & MDB_TXN_WRITEMAP) && !(flags & MDB_RDONLY))
                        return EINVAL;
                pthread_mutex_lock(&parent->mt_child_mutex);
@@ -3508,6 +3506,8 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret)
                        flags &= ~MDB_TXN_HAS_CHILD;
                }
                pthread_mutex_unlock(&parent->mt_child_mutex);
+               if (flags & MDB_TXN_BLOCKED)
+                       return (flags & MDB_TXN_RDONLY) ? EINVAL : MDB_BAD_TXN;
                /* Child txns save MDB_pgstate and use own copy of cursors */
                size = env->me_maxdbs * (sizeof(MDB_db)+sizeof(MDB_cursor *)+1);
                size += tsize = sizeof(MDB_ntxn);