From: Akinobu Mita Date: Sat, 29 Jun 2013 08:59:17 +0000 (+0900) Subject: [SCSI] scsi_debug: invalidate protection info for unmapped region X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e9926b4376544d5a2dc4d310d4d0006c634b1a93;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [SCSI] scsi_debug: invalidate protection info for unmapped region When UNMAP command is issued with the data integrity support enabled, the protection info for the unmapped region is remain unchanged. So READ command for the region later on causes data integrity failure. This fixes it by invalidating protection info for the unmapped region by filling with 0xff pattern. Signed-off-by: Akinobu Mita Acked-by: Douglas Gilbert Acked-by: "Martin K. Petersen" Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index e83e661b0257..83efec2919b1 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -2064,6 +2064,11 @@ static void unmap_region(sector_t lba, unsigned int len) scsi_debug_sector_size * scsi_debug_unmap_granularity); } + if (dif_storep) { + memset(dif_storep + lba, 0xff, + sizeof(*dif_storep) * + scsi_debug_unmap_granularity); + } } lba = map_index_to_lba(index + 1); }