mdbx: temporary workaround/hotfix for a flaw of Linux 4.19 (at least) unified page/buffer cache.

Temporary workaround for https://github.com/erthink/libmdbx/issues/269.
This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-02-22 23:48:58 +03:00
parent 1fd4101e2e
commit 6b45498985

View File

@ -12780,6 +12780,22 @@ __cold int mdbx_env_open(MDBX_env *env, const char *pathname,
goto bailout;
}
}
#elif defined(__linux__) || defined(__gnu_linux__)
/* Temporary workaround for Linux 4.19 (at least) kernel's flaw.
* See https://github.com/erthink/libmdbx/issues/269 */
if ((flags & MDBX_WRITEMAP) == 0 &&
mdbx_linux_kernel_version < 0x05040000) {
if (flags & MDBX_ACCEDE)
flags |= MDBX_WRITEMAP;
else {
mdbx_debug_log(MDBX_LOG_ERROR, __func__, __LINE__,
"Linux prior to 5.4 requires MDBX_WRITEMAP because "
"of a flaw of unified page/buffer cache. "
"See https://github.com/erthink/libmdbx/issues/269\n");
rc = ENOPROTOOPT;
goto bailout;
}
}
#endif /* MDBX_MMAP_INCOHERENT_FILE_WRITE */
}