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

From: Chris Down

Date: Sat Nov 28 2026 - 04:27:01 EST


Hi Christoph,

Christoph Hellwig writes:
>Shoudn't we simply refuse to use writesame_10_unmap for devices
>where 10-byte commands can't fit the entire capacity instead?

Yeah, that's simpler. I'll do that in v2, both when sd picks the mode
and when it's written to zeroing_mode in sysfs.

That only takes care of the LBA, though. sd_config_write_same() keeps a
write zeroes limit above 0xffff blocks if the device reports one, so
the count can still be truncated in writesame_10_unmap mode, even on a
small disk. I think we should still cap the limit in that mode, as
sd_config_discard() already does for the discard limit in writesame_10
mode. Does that sound ok?

Thanks!

Chris