From: Howard Chu Date: Wed, 15 Apr 2026 18:39:36 +0000 (+0100) Subject: ITS#10454 lmdb: can't rely on O_DSYNC on MacOS X-Git-Tag: LMDB_1.0.0-branch~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bd9cd548b02e77fea8e9ba5d03993b1a688ef223;p=thirdparty%2Fopenldap.git ITS#10454 lmdb: can't rely on O_DSYNC on MacOS So we must explicitly sync writes to the metapage. --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 6247f867ab..1c885e8dd6 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -4865,6 +4865,12 @@ mdb_env_write_meta(MDB_txn *txn) rc = ErrCode(); goto fail; } +#if defined(__APPLE__) + if (MDB_FDATASYNC(env->me_mfd)) { + rc = ErrCode(); + goto fail; + } +#endif } goto done; } @@ -4924,6 +4930,12 @@ fail: env->me_flags |= MDB_FATAL_ERROR; return rc; } +#if defined(__APPLE__) + if (mfd == env->me_mfd && MDB_FDATASYNC(env->me_mfd)) { + rc = ErrCode(); + return rc; + } +#endif /* MIPS has cache coherency issues, this is a no-op everywhere else */ CACHEFLUSH(env->me_map + off, len, DCACHE); done: