[PATCH 04/12] block: remove the blk_integrity_profile structure
Christoph Hellwig
hch at lst.de
Wed Jun 5 21:49:06 PDT 2024
On Wed, Jun 05, 2024 at 08:05:20PM +0530, Kanchan Joshi wrote:
> On Wed, Jun 5, 2024 at 12:01???PM Christoph Hellwig <hch at lst.de> wrote:
> > @@ -446,13 +446,14 @@ bool bio_integrity_prep(struct bio *bio)
> > if (bio_integrity(bio))
> > return true;
> >
> > + if (!bi->csum_type)
> > + return true;
>
> Changes look mostly good, but trigger a behavior change for non-PI
> metadata format.
>
> Earlier nop profile was registered for that case. And the block-layer
> continued to attach an appropriately sized meta buffer to incoming IO, even
> though it did not generate/verify. Hence, IOs don't fail.
>
> Now also we show that the nop profile is set, but the above
> "csum_type" check ensures that
> meta buffer is not attached and REQ_INTEGRITY is not set in the bio.
> NVMe will start failing IOs with BLK_STS_NOTSUPP now [*].
Yes. I didn't remember that odd case and failed to test it, but I can
trivially reproduce it now.
Which brings up another issue: bio_integrity_prep allocates the metadata
buffer using kmalloc, so we'll leak write random kernel memory to the
devices for this case which is ... not good. I guess for stable fixes
and backports I'll add a real generate_fn that just zeroes all the
memory for now.
More information about the Linux-nvme
mailing list