Skip to content

Commit 8e48727

Browse files
Salomon Dushimirimanamartinkpetersen
authored andcommitted
scsi: sd: Make sd shutdown issue START STOP UNIT appropriately
Commit aa3998d ("ata: libata-scsi: Disable scsi device manage_system_start_stop") enabled libata EH to manage device power mode trasitions for system suspend/resume and removed the flag from ata_scsi_dev_config. However, since the sd_shutdown() function still relies on the manage_system_start_stop flag, a spin-down command is not issued to the disk with command "echo 1 > /sys/block/sdb/device/delete" sd_shutdown() can be called for both system/runtime start stop operations, so utilize the manage_run_time_start_stop flag set in the ata_scsi_dev_config and issue a spin-down command during disk removal when the system is running. This is in addition to when the system is powering off and manage_shutdown flag is set. The manage_system_start_stop flag will still be used for drivers that still set the flag. Fixes: aa3998d ("ata: libata-scsi: Disable scsi device manage_system_start_stop") Signed-off-by: Salomon Dushimirimana <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Damien Le Moal <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent a28f981 commit 8e48727

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/scsi/sd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4168,7 +4168,9 @@ static void sd_shutdown(struct device *dev)
41684168
if ((system_state != SYSTEM_RESTART &&
41694169
sdkp->device->manage_system_start_stop) ||
41704170
(system_state == SYSTEM_POWER_OFF &&
4171-
sdkp->device->manage_shutdown)) {
4171+
sdkp->device->manage_shutdown) ||
4172+
(system_state == SYSTEM_RUNNING &&
4173+
sdkp->device->manage_runtime_start_stop)) {
41724174
sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
41734175
sd_start_stop_device(sdkp, 0);
41744176
}

0 commit comments

Comments
 (0)