mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 00:26:36 +03:00
This flag allows disabling the mincore() syscall introduced in
50fc48ac47. On older ZFS filesystems,
mincore() may trigger a bug related to ZFSÕs own in-memory cache. Mixing
reads from mmap()ed files and direct disk reads can corrupt the ZFS ARC
cache and lead to data read corruption.
Fixes https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10327
25 lines
477 B
Go
25 lines
477 B
Go
//go:build linux
|
|
|
|
package fs
|
|
|
|
import (
|
|
"unsafe"
|
|
|
|
"golang.org/x/sys/unix"
|
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/logger"
|
|
)
|
|
|
|
func supportsMincore() bool {
|
|
return true
|
|
}
|
|
func mincore(ptr *byte) bool {
|
|
var result [1]byte
|
|
_, _, err := unix.Syscall(unix.SYS_MINCORE, uintptr(unsafe.Pointer(ptr)), 1, uintptr(unsafe.Pointer(&result[0])))
|
|
if err != 0 {
|
|
logger.Panicf("FATAL: cannot call mincore(ptr=%p, 1): %s", ptr, err)
|
|
}
|
|
ok := (result[0] & 1) == 1
|
|
return ok
|
|
}
|