Commit 026ffaf6 authored by Douglas Gilbert's avatar Douglas Gilbert Committed by Greg Kroah-Hartman

scsi: scsi_debug: write_same: fix error report


[ Upstream commit e33d7c56 ]

The scsi_debug driver incorrectly suggests there is an error with the
SCSI WRITE SAME command when the number_of_logical_blocks is greater
than 1. It will also suggest there is an error when NDOB
(no data-out buffer) is set and the number_of_logical_blocks is
greater than 0. Both are valid, fix.
Signed-off-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d8914530
...@@ -2996,11 +2996,11 @@ static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num, ...@@ -2996,11 +2996,11 @@ static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num,
if (-1 == ret) { if (-1 == ret) {
write_unlock_irqrestore(&atomic_rw, iflags); write_unlock_irqrestore(&atomic_rw, iflags);
return DID_ERROR << 16; return DID_ERROR << 16;
} else if (sdebug_verbose && (ret < (num * sdebug_sector_size))) } else if (sdebug_verbose && !ndob && (ret < sdebug_sector_size))
sdev_printk(KERN_INFO, scp->device, sdev_printk(KERN_INFO, scp->device,
"%s: %s: cdb indicated=%u, IO sent=%d bytes\n", "%s: %s: lb size=%u, IO sent=%d bytes\n",
my_name, "write same", my_name, "write same",
num * sdebug_sector_size, ret); sdebug_sector_size, ret);
/* Copy first sector to remaining blocks */ /* Copy first sector to remaining blocks */
for (i = 1 ; i < num ; i++) for (i = 1 ; i < num ; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment