Message ID | 20240809193115.1222737-3-bvanassche@acm.org |
---|---|
State | New |
Headers | show |
Series | Fix system resume for SCSI devices | expand |
On 8/10/24 04:31, Bart Van Assche wrote: > During system resume, sd_start_stop_device() submits a START STOP UNIT > command to the SCSI device that is being resumed. That command is not > retried in case of a unit attention and hence may fail. An example: > > [16575.983359] sd 0:0:0:3: [sdd] Starting disk > [16575.983693] sd 0:0:0:3: [sdd] Start/Stop Unit failed: Result: hostbyte=0x00 driverbyte=DRIVER_OK > [16575.983712] sd 0:0:0:3: [sdd] Sense Key : 0x6 > [16575.983730] sd 0:0:0:3: [sdd] ASC=0x29 ASCQ=0x0 > [16575.983738] sd 0:0:0:3: PM: dpm_run_callback(): scsi_bus_resume+0x0/0xa0 returns -5 > [16575.983783] sd 0:0:0:3: PM: failed to resume async: error -5 > > Make the SCSI core retry the START STOP UNIT command if a retryable > error is encountered. > > Cc: Damien Le Moal <dlemoal@kernel.org> > Cc: Mike Christie <michael.christie@oracle.com> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> Looks OK to me. Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 718eb91ba9a5..4cbf3e5740e1 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -4093,6 +4093,7 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start) const struct scsi_exec_args exec_args = { .sshdr = &sshdr, .req_flags = BLK_MQ_REQ_PM, + .scmd_flags = SCMD_RETRY_PASSTHROUGH, }; struct scsi_device *sdp = sdkp->device; int res;
During system resume, sd_start_stop_device() submits a START STOP UNIT command to the SCSI device that is being resumed. That command is not retried in case of a unit attention and hence may fail. An example: [16575.983359] sd 0:0:0:3: [sdd] Starting disk [16575.983693] sd 0:0:0:3: [sdd] Start/Stop Unit failed: Result: hostbyte=0x00 driverbyte=DRIVER_OK [16575.983712] sd 0:0:0:3: [sdd] Sense Key : 0x6 [16575.983730] sd 0:0:0:3: [sdd] ASC=0x29 ASCQ=0x0 [16575.983738] sd 0:0:0:3: PM: dpm_run_callback(): scsi_bus_resume+0x0/0xa0 returns -5 [16575.983783] sd 0:0:0:3: PM: failed to resume async: error -5 Make the SCSI core retry the START STOP UNIT command if a retryable error is encountered. Cc: Damien Le Moal <dlemoal@kernel.org> Cc: Mike Christie <michael.christie@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/scsi/sd.c | 1 + 1 file changed, 1 insertion(+)