Re: [PATCH 2/2] scsi: sd: Fix data corruption in WRITE SAME(10) discards

From: Christoph Hellwig

Date: Wed Nov 11 2026 - 11:53:04 EST


On Sat, Nov 07, 2026 at 08:35:29AM -0800, Chris Down wrote:
> We already cap the discard length in writesame_10 and writesame_zero
> mode, but we still truncate the starting LBA to 32 bits. A discard at
> or above block 2^32 can corrupt live data near the start of the disk
> and still report success.
>
> Discard is advisory, so return BLK_STS_NOTSUPP if the request won't
> fit in WRITE SAME(10). Discards that fit can still go through.

Nah, that's not really how things work. See my reply to patch 1
for the suggested proper fix.