Re: fall back from direct to buffered I/O when stable writes are required

From: Christoph Hellwig

Date: Fri Nov 14 2025 - 00:39:48 EST


On Thu, Nov 13, 2025 at 06:39:07PM +0100, Kevin Wolf wrote:
> > A complication is that PI could relax that requirement if we support
> > PI passthrough from userspace (currently only for block device, but I
> > plan to add file system support), where the device checks it, but we
> > can't do that for parity RAID.
>
> Not sure I understand the problem here. If it's passed through from
> userspace, isn't its validity the problem of userspace, too? I'd expect
> that you only need a bounce buffer in the kernel if the kernel itself
> does something like a checksum calculation?

Yes, the PI validity is a userspace problem. But if you then also use
software RAID (right now mdraid RAID5/6 does not support PI, so that's a
theoretical case), a (potentially malicious) modification of in-flight
data could still corrupt data in another stripe. So we'd still have to
bounce buffer for user passed PI when using parity RAID below, but not
when just sending on the PI to a device (which also checks the validity
and rejects the I/O).