Skip to content

Commit f5e705c

Browse files
damien-lemoalmehmetb0
authored andcommitted
scsi: sd: Do not repeat the starting disk message
BugLink: https://bugs.launchpad.net/bugs/2097393 [ Upstream commit 7a6bbc2 ] The SCSI disk message "Starting disk" to signal resuming of a suspended disk is printed in both sd_resume() and sd_resume_common() which results in this message being printed twice when resuming from e.g. autosuspend: $ echo 5000 > /sys/block/sda/device/power/autosuspend_delay_ms $ echo auto > /sys/block/sda/device/power/control [ 4962.438293] sd 0:0:0:0: [sda] Synchronizing SCSI cache [ 4962.501121] sd 0:0:0:0: [sda] Stopping disk $ echo on > /sys/block/sda/device/power/control [ 4972.805851] sd 0:0:0:0: [sda] Starting disk [ 4980.558806] sd 0:0:0:0: [sda] Starting disk Fix this double print by removing the call to sd_printk() from sd_resume() and moving the call to sd_printk() in sd_resume_common() earlier in the function, before the check using sd_do_start_stop(). Doing so, the message is printed once regardless if sd_resume_common() actually executes sd_start_stop_device() (i.e. SCSI device case) or not (libsas and libata managed ATA devices case). Fixes: 0c76106 ("scsi: sd: Fix TCG OPAL unlock on system resume") Cc: [email protected] Signed-off-by: Damien Le Moal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: John Garry <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Manuel Diewald <[email protected]> Signed-off-by: Koichiro Den <[email protected]>
1 parent d6bd389 commit f5e705c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/scsi/sd.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3960,8 +3960,6 @@ static int sd_resume(struct device *dev)
39603960
{
39613961
struct scsi_disk *sdkp = dev_get_drvdata(dev);
39623962

3963-
sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
3964-
39653963
if (opal_unlock_from_suspend(sdkp->opal_dev)) {
39663964
sd_printk(KERN_NOTICE, sdkp, "OPAL unlock failed\n");
39673965
return -EIO;
@@ -3978,12 +3976,13 @@ static int sd_resume_common(struct device *dev, bool runtime)
39783976
if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */
39793977
return 0;
39803978

3979+
sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
3980+
39813981
if (!sd_do_start_stop(sdkp->device, runtime)) {
39823982
sdkp->suspended = false;
39833983
return 0;
39843984
}
39853985

3986-
sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
39873986
ret = sd_start_stop_device(sdkp, 1);
39883987
if (!ret) {
39893988
sd_resume(dev);

0 commit comments

Comments
 (0)