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

Kevin Wolf
2025-11-14T09:29:54Z

Am 14.11.2025 um 06:39 hat Christoph Hellwig geschrieben:
> 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).

Right, but since this is direct I/O and the approach with only declaring
I/O from the page cache safe without a bounce buffer means that RAID has
to use a bounce buffer here anyway (with or without PI), doesn't this
automatically solve it?

So if it's only PI, it's the problem of userspace, and if you add RAID
on top, then the normal rules for RAID apply. (And that the buffer
doesn't get modified and PI doesn't become invalid until RAID does its
thing is still a userspace problem.)

Kevin