-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
O_DIRECT with EINVAL error #57047
Comments
Can you post a simple code that reproduces the issue and run the program with |
|
|
O_DIRECT requires that the buffer is a multiple of 512 but also that it's aligned on a 512 byte boundary. Not all file systems enforce that but some do. In node, it's not very practical to get a buffer with a particular alignment so you're probably out of luck. |
sorry, english is not my first language, should i read it: in nodejs there is no way to tell to the linux kernel to bypass page cache |
Yes, that's what I mean. |
Version
v23.8.0, v22.14.0, v20.18.2
Platform
Subsystem
fs
What steps will reproduce the bug?
Using file reading or writing with the
constants.O_DIRECT
flag in results in anEINVAL: invalid argument, read
error when attempting to read a file.Tested on
xfs
andoverlayfs
filesystems on Linux.The same code works on
tmpfs
and on macos, obviously ;)Interestingly, a similar implementation in Go using
syscall.Open(..., syscall.O_DIRECT | syscall.O_SYNC, ...)
andsyscall.Read
does work without errors on the samexfs
andoverlayfs
filesystems.How often does it reproduce? Is there a required condition?
createReadStream, createWriteStream, read after open
What is the expected behavior? Why is that the expected behavior?
file I/O to bypass the Linux kernel's caches
What do you see instead?
Uncaught Error: EINVAL: invalid argument, read
Additional information
No response
The text was updated successfully, but these errors were encountered: