Skip to content

Commit

Permalink
scsi: scsi_debug: write_same: fix error report
Browse files Browse the repository at this point in the history
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: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Douglas Gilbert authored and Martin K. Petersen committed Oct 31, 2017
1 parent 013ee63 commit e33d7c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/scsi/scsi_debug.c
Original file line number Diff line number Diff line change
@@ -3001,11 +3001,11 @@ static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num,
if (-1 == ret) {
write_unlock_irqrestore(&atomic_rw, iflags);
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,
"%s: %s: cdb indicated=%u, IO sent=%d bytes\n",
"%s: %s: lb size=%u, IO sent=%d bytes\n",
my_name, "write same",
num * sdebug_sector_size, ret);
sdebug_sector_size, ret);

/* Copy first sector to remaining blocks */
for (i = 1 ; i < num ; i++)

0 comments on commit e33d7c5

Please sign in to comment.