@@ -4653,6 +4653,7 @@ static void zbc_rwp_zone(struct sdebug_dev_info *devip,
struct sdeb_zone_state *zsp)
{
enum sdebug_z_cond zc;
+ struct sdeb_store_info *sip = devip2sip(devip, false);
if (zbc_zone_is_conv(zsp))
return;
@@ -4667,6 +4668,9 @@ static void zbc_rwp_zone(struct sdebug_dev_info *devip,
zsp->z_non_seq_resource = false;
zsp->z_wp = zsp->z_start;
zsp->z_cond = ZC1_EMPTY;
+
+ memset(sip->storep + zsp->z_start * sdebug_sector_size, 0,
+ devip->zsize * sdebug_sector_size);
}
static void zbc_rwp_all(struct sdebug_dev_info *devip)
When reset write pointer is requested to scsi_debug devices with zoned model, positions of write pointers are reset, but the data in the target zones are not cleared. Read to the zones returns data written before the reset write pointer. This unexpected left data is confusing and does not allow using scsi_debug for stale page cache test of the BLKRESETZONE ioctl. Hence, zero clear the target zones at reset write pointer. Fixes: f0d1cf9378bd ("scsi: scsi_debug: Add ZBC zone commands") Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> --- drivers/scsi/scsi_debug.c | 4 ++++ 1 file changed, 4 insertions(+)