#define CACHEFLUSH(addr, bytes, cache)
#endif
+#if defined(__linux) && !defined(MDB_FDATASYNC_WORKS)
+/** fdatasync is broken on ext3/ext4fs on older kernels, see
+ * description in #mdb_env_open2 comments
+ */
+#define BROKEN_FDATASYNC
+#endif
#include <errno.h>
#include <limits.h>
#ifdef _WIN32
int me_pidquery; /**< Used in OpenProcess */
#endif
-#ifdef __linux
+#ifdef BROKEN_FDATASYNC
int me_fsynconly; /**< fdatasync is unreliable */
#endif
#if defined(_WIN32) || defined(MDB_USE_SYSV_SEM)
rc = ErrCode();
#endif
} else {
-#ifdef __linux
+#ifdef BROKEN_FDATASYNC
if (env->me_fsynconly) {
if (fsync(env->me_fd))
rc = ErrCode();
return MDB_SUCCESS;
}
-#ifdef __linux
+#ifdef BROKEN_FDATASYNC
#include <sys/utsname.h>
#include <sys/vfs.h>
#endif
env->me_pidquery = PROCESS_QUERY_INFORMATION;
#endif /* _WIN32 */
-#ifdef __linux
+#ifdef BROKEN_FDATASYNC
/* ext3/ext4 fdatasync is broken on some older Linux kernels.
* https://lkml.org/lkml/2012/9/3/83
* Kernels after 3.6-rc6 are known good.