[PATCHv2] block: always allocate integrity buffer

Keith Busch kbusch at kernel.org
Thu May 8 09:14:13 PDT 2025


On Thu, May 08, 2025 at 07:12:33AM +0200, Christoph Hellwig wrote:
> > allocated and attached to the bio entirely. We only want to suppress the
> > protection checks on the device and host, but we still need the buffer.
> > 
> > Otherwise, reads and writes will just get IO errors and this nvme warning:
> 
> But to a point - the metadata buffer is only required for non-PI
> metadata.  I think from looking at the code that is exactly what
> this patch does, but the commit log sounds different.

Not exactly. If anyone's intention was to use this specifically to force
nvme pract for those special PI formats, then this patch would change
that. The driver would just get an unchecked metadata buffer instead.

This is more about just preventing the kernel from sending a request
that the driver is going to reject. Like if someone mistakenly messes
with these attributes on formats where PRACT doesn't work.

One use case is like when the kernel started supporting PI offsets
(~6.8?), and that broke the upgrade path since previously written data
wouldn't pass the newly enforced checksum on reads, so we need ways to
disable the checks.

But since you mention it, maybe someone does want to force PRACT on the
generic read/write path? I considered it a fallback when the kernel
doesn't have CONFIG_BLK_DEV_INTEGRITY, but we could control it at
runtime through these attributes too. It would just need a new flag in
the blk_integrity profile to say if format supports controller-side
strip/generation and use that to decide if we need to attach an
unchecked integrity payload or not.



More information about the Linux-nvme mailing list