From c46c03e7c8681d279fdb676791d44d92bca7cc68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Fri, 18 Nov 2022 20:04:09 +0300 Subject: [PATCH] mdbx: fix nasty typo/rebase/merge bug with calling `msync()` on Linux. --- src/osal.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/osal.c b/src/osal.c index 71046f6c..9bd30d04 100644 --- a/src/osal.c +++ b/src/osal.c @@ -1706,10 +1706,15 @@ MDBX_INTERNAL_FUNC int osal_msync(const osal_mmap_t *map, size_t offset, return (int)GetLastError(); #else #if defined(__linux__) || defined(__gnu_linux__) - assert(linux_kernel_version > 0x02061300); /* Since Linux 2.6.19, MS_ASYNC is in fact a no-op. The kernel properly - * tracks dirty pages and flushes them to storage as necessary. */ - return MDBX_SUCCESS; + * tracks dirty pages and flushes ones as necessary. */ + // + // However, this behavior may be changed in custom kernels, + // so just leave such optimization to the libc discretion. + // + // assert(linux_kernel_version > 0x02061300); + // if (mode_bits == MDBX_SYNC_NONE) + // return MDBX_SUCCESS; #endif /* Linux */ if (msync(ptr, length, (mode_bits & MDBX_SYNC_DATA) ? MS_SYNC : MS_ASYNC)) return errno;