Re: [PATCH 1/2] scsi: sd: Fix data corruption in WRITE SAME(10) write zeroes
From: Christoph Hellwig
Date: Wed Nov 11 2026 - 11:51:18 EST
On Sat, Nov 07, 2026 at 08:35:14AM -0800, Chris Down wrote:
> In writesame_10_unmap mode, we send write zeroes as WRITE SAME(10).
> If the LBA or count doesn't fit, we truncate it and can return
> success without zeroing the requested range. If the LBA wraps, we
> can also corrupt live data near the start of the disk.
>
> Cap the queue limit when sd selects this mode so large requests can
> still unmap in chunks. If the LBA or count still won't fit, fall back
> to WRITE SAME(16) with UNMAP clear. All the caller needs is for the
> requested blocks to read back as zeroes.
Shoudn't we simply refuse to use writesame_10_unmap for devices
where 10-byte commands can't fit the entire capacity instead?