Re: [PATCH v2 2/5] scsi: sd: Fix data corruption in WRITE SAME(10) write zeroes
From: Chris Down
Date: Sun Nov 29 2026 - 14:25:56 EST
Hi Bart,
Thanks for the detailed review! Much appreciated.
Bart Van Assche writes:
>(sector_t)U32_MAX + 1 is easier to read than `1 + (sector_t)0xffffffff`.
Sure, I'll use that in v3.
>If zeroing_mode_store() uses queue_limits_start_update() +
>blk_mq_freeze_queue() + queue_limits_commit_update() + unfreeze (like
>provisioning_mode_store()) and updates lim.max_hw_wzeroes_unmap_sectors,
>it closes these races and fixes the stale unmap limit after sysfs
>writes.
Yeah, that makes sense, I'll do that in v3. The limit update fits in
patch 1, and the check here moves under the limits lock.
max_write_same_blocks_store() needs the same for your second case,
since it sets max_ws_blocks before it takes the lock. With scsi_debug
I can get v2 to send WRITE SAME(10) with a count of zero that way, so
I'll change it together with the other stores in patch 4.
Chris