mdbx: add workaround for ext4 fast-commit bug.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev)
2025-11-07 21:17:18 +03:00
parent 3f8dad1ede
commit f2f2cc3b40

View File

@@ -1648,6 +1648,16 @@ int osal_fsetsize(mdbx_filehandle_t fd, const uint64_t length) {
return MDBX_SUCCESS;
#endif
#if defined(__linux__) || defined(__gnu_linux__)
if (globals.linux_kernel_version < 0x05110000 && globals.linux_kernel_version >= 0x050a0000) {
struct statfs statfs_info;
if (fstatfs(fd, &statfs_info))
return errno;
if (statfs_info.f_type == 0xEF53 /* EXT4_SUPER_MAGIC */ && unlikely(fdatasync(fd)))
return errno;
}
#endif /* Linux */
return unlikely(ftruncate(fd, length)) ? errno : MDBX_SUCCESS;
#endif /* !Windows */