On Tue, Feb 4, 2025 at 2:19 AM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: > > On Fri, Jan 31, 2025 at 05:06:50PM -0300, Travis Downs wrote: > Yes. > > This is all about direct I/O. > > > So is it fair to say that for direct IO these types of racy writes are not safe? > > In general: yes. Thanks Christoph, this is all very helpful. I appreciate your replies. > > > > Specifically, we are looking at behavior in a 3rd party, proprietary > > block device > > (implemented as a kernel module) and are wondering if these types of racy > > writes break the implied or explicit semantics of safe direct IO writes. > > I have no interest in helping anyone into looking proprietary drivers. Totally fair, and it's why for this list I would frame it as a question of what is the contract between userspace, the VFS layer, the FS, the block layer and the block driver. Having that well defined is useful for in-tree devices, out-of- tree open source devices and, unavoidably, closed-source devices. So I would summarize the current situation as: "It is allowable for any FS and block device to assume that direct IO userspace buffers are stable, and if they are not, there are few guarantees about the results of unstable writes. The generic parts of the storage layer, and common drivers like NVMe block driver, may today provide reasonable semantics in this case (e.g., the unmodified part of the buffer is written with the expected values) but that is not a guarantee and may change in the future".