scsi: sd: Do not repeat the starting disk message
PATCH v2 1/1 scsi: sd: Do not repeat the starting disk message
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).
---
Changes from v1:
- Fixed typo in commit message
- Added Bart's review tag
drivers/scsi/sd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/sd.c +2 -3
@@ -4119,8 +4119,6 @@ static int sd_resume(struct device *dev) {struct scsi_disk *sdkp =dev_get_drvdata (dev); -sd_printk (KERN_NOTICE , sdkp,"Starting disk\n" ); -if (opal_unlock_from_suspend (sdkp->opal_dev)) {sd_printk (KERN_NOTICE , sdkp,"OPAL unlock failed\n" );return -EIO ;
@@ -4137,12 +4135,13 @@ static int sd_resume_common(struct device *dev, bool runtime)if (!sdkp)/* E.g.: runtime resume at the start of sd_probe() */ return 0 ; +sd_printk (KERN_NOTICE , sdkp,"Starting disk\n" ); +if (!sd_do_start_stop (sdkp->device, runtime)) { sdkp->suspended = false;return 0 ; } -sd_printk (KERN_NOTICE , sdkp,"Starting disk\n" ); ret =sd_start_stop_device (sdkp,1 );if (!ret) {sd_resume (dev);
Signature · 1 line
2.45.2
Quoted 23 lines · Damien Le Moal
The scsi disk message "Starting disk" to signal resuming of a suspended disk is printed in both
sd_resume()andsd_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 diskFix this double print by removing the call to
sd_printk()fromsd_resume()and moving the call tosd_printk()insd_resume_common()earlier in the function, before the check usingsd_do_start_stop(). Doing so, the message is printed once regardless ifsd_resume_common()actually executessd_start_stop_device()(i.e. scsi device case) or not (libsas and libata managed ATA devices case).
Quoted 4 lines
Fixes 0c76106cb975 ("scsi: sd: Fix TCG OPAL unlock on system resume")Signed-off-by Damien Le Moal<[email protected]>Reviewed-by Bart Van Assche<[email protected]>
Martin K. Petersen
AppliedDamien,
Quoted 4 lines
The scsi disk message "Starting disk" to signal resuming of a suspended disk is printed in both
sd_resume()andsd_resume_common(), which results in this message being printed twice when resuming from e.g. autosuspend:
Applied to 6.10/scsi-fixes, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering