scsi: sd: Fix WRITE SAME(10) data corruption
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | scsi: sd: Fix data corruption in WRITE SAME(10) write zeroesdrivers/ | +9 | 1 reply | |
| 2/2 | scsi: sd: Fix data corruption in WRITE SAME(10) discardsdrivers/ | +3 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] scsi: sd: Fix WRITE SAME(10) data corruption
With scsi_debug and 512-byte logical blocks, a 1 MiB discard at 2 TiB succeeds, but it's the first MiB of the disk that gets discarded. This happens because the starting LBA wraps to zero, because it doesn't fit in WRITE SAME(10).
Write zeroes can also run out of bits for the block count. With a 0x20000-block WRITE SAME limit, a 64 MiB hole punch sends a count of zero and leaves the whole range as it was.
Let's use plain WRITE SAME(16) for write zeroes when the LBA or count won't fit in WRITE SAME(10). For discard, we can just refuse the request and leave the data alone.
Chris Down (2):
scsi: sd: Fix data corruption in WRITE SAME(10) write zeroes
scsi: sd: Fix data corruption in WRITE SAME(10) discards
drivers/scsi/sd.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
base-commit: 04feb5fd2c23894ebc2cdaf4a4cc38b8667b17ac
Signature · 1 line
2.54.0