|
|
Subscribe / Log in / New account

Corner case

Corner case

Posted Nov 12, 2025 20:02 UTC (Wed) by kreijack (guest, #43513)
In reply to: Corner case by abatters
Parent article: The intersection of unstable pages and direct I/O

> One interesting corner case is if you have a single page involved in two non-overlapping direct I/Os simultaneously at different offsets. The I/Os won't conflict with each other logically, but if they add these restrictions, the kernel may incorrectly detect a conflict based on page granularity.

My be that I am misunderstanding something, but direct-I/O have some requirements. One of these is that the read/write size shall be multiple of the page size, and the offset must be multiple of the page size. So under direct-io is not possible to update a portion of a page, because you have to write (at least) the full-page.


to post comments

Corner case

Posted Nov 12, 2025 20:20 UTC (Wed) by abatters (✭ supporter ✭, #6932) [Link]

The alignment requirements have been relaxed over the years. See the O_DIRECT section under:

https://www.man7.org/linux/man-pages/man2/open.2.html#NOTES

Corner case

Posted Nov 12, 2025 20:23 UTC (Wed) by koverstreet (✭ supporter ✭, #4296) [Link]

It's important to note that there are different alignment requirements for the buffer - "dma alignment" - and the file offset, and they both have to be checked for (via statx).

We recently ran into an application (rocksdb) that didn't work on bcachefs in largebs mode because of this - it was only checking dma alignment, not offset.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds