scsi: scsi_debug: Implement tur_ms_to_ready parameter
authorDouglas Gilbert <dgilbert@interlog.com>
Fri, 24 Jul 2020 15:55:31 +0000 (11:55 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 29 Jul 2020 04:03:52 +0000 (00:03 -0400)
commitfc13638ae92ee9eb861732d642d922d577b82a9e
treef8ada45efa2aaa39698ab5462a0ee1b7da804b3d
parent84905d34f14987687ab1be64f15b453d11a41e55
scsi: scsi_debug: Implement tur_ms_to_ready parameter

The current driver responds to TEST UNIT READY (TUR) with a GOOD status
immediately after a scsi_debug device (LU) is created. This is unrealistic
as even SSDs take some time after power-on before accepting media access
commands.

Add the tur_ms_to_ready parameter whose unit is milliseconds (default 0)
and is the period before which a TUR (or any media access command) will set
the CHECK CONDITION status with a sense key of NOT READY and an additional
sense of "Logical unit is in process of becoming ready".  The period starts
when each scsi_debug device is created.

This patch was prompted by T10 proposal 20-061r2 which was accepted on
2020716. It adds that a TUR in the situation described in the previous
paragraph may set the INFO field (or descriptor) in the sense data to the
estimated number in milliseconds before a subsequent TUR will yield a GOOD
status. This patch follows that advice.

Link: https://lore.kernel.org/r/20200724155531.668144-1-dgilbert@interlog.com
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_debug.c