lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ad9e3921-43ed-4abd-acce-ce46d57f32c8@acm.org>
Date: Thu, 24 Jul 2025 13:46:22 -0700
From: Bart Van Assche <bvanassche@....org>
To: Salomon Dushimirimana <salomondush@...gle.com>,
 "James E . J . Bottomley" <James.Bottomley@...senPartnership.com>,
 "Martin K . Petersen" <martin.petersen@...cle.com>
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
 Vishakha Channapattan <vishakhavc@...gle.com>
Subject: Re: [PATCH] scsi: sd: fix sd shutdown to issue START STOP UNIT
 command appropriately

On 7/24/25 1:38 PM, Salomon Dushimirimana wrote:
> Commit aa3998dbeb3a ("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.
> 
> Signed-off-by: Salomon Dushimirimana <salomondush@...gle.com>
> ---
>   drivers/scsi/sd.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index eeaa6af294b81..282000c761f8e 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -4173,7 +4173,9 @@ static void sd_shutdown(struct device *dev)
>   	if ((system_state != SYSTEM_RESTART &&
>   	     sdkp->device->manage_system_start_stop) ||
>   	    (system_state == SYSTEM_POWER_OFF &&
> -	     sdkp->device->manage_shutdown)) {
> +	     sdkp->device->manage_shutdown) ||
> +	    (system_state == SYSTEM_RUNNING &&
> +	     sdkp->device->manage_runtime_start_stop)) {
>   		sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
>   		sd_start_stop_device(sdkp, 0);
>   	}

A Fixes: tag is missing.

manage_runtime_start_stop is for runtime power management.
/sys/block/*/device/delete is not related to runtime power management.
Isn't manage_system_start_stop more appropriate here than
manage_runtime_start_stop? Shouldn't sd_shutdown() calls triggered by
writing into /sys/block/*/device/delete already be covered by this
test: system_state != SYSTEM_RESTART &&
   sdkp->device->manage_system_start_stop?

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ