Re: [PATCH 5/6] NFSD: leverage DIO alignment to selectively issue O_DIRECT reads and writes

Christoph Hellwig
2025-06-11T07:00:02Z

On Tue, Jun 10, 2025 at 04:57:36PM -0400, Mike Snitzer wrote:
> IO must be aligned, otherwise it falls back to using buffered IO.
>
> RWF_DONTCACHE is _not_ currently used for misaligned IO (even when
> nfsd/enable-dontcache=1) because it works against us (due to RMW
> needing to read without benefit of cache), whereas buffered IO enables
> misaligned IO to be more performant.

This seems to "randomly" mix direct I/O and buffered I/O on a file.
That's basically asking for data corruption due to invalidation races.

But maybe also explain what this is trying to address to start with?