Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19BCB2868AF; Tue, 12 Aug 2025 17:50:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755021051; cv=none; b=UMCkzDbIkJlhJdYdXYDFQ2a9EukZI3AwWyIflmmKBiHKnnKMM7Qcnepi+/nn7y0ZhccjaP8zXWcDvpIKWzwr+Vx5UNfeHWFB1EEeIPAmtjWWzL1YvIEfgKjphugS6/nxPYrMhS/KvMANAO4iUWViEm9ykD5aX3f+UNi63yDCaTo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755021051; c=relaxed/simple; bh=44bJ1M1ir5KNAstPzdm8GAy4SxNxAdlPTjqTN4SqpAc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TOZ5f2akN6CLUNCcxQS1psMLGTAnn2RKxqKWDFNk6R965xmv2Klj2A4hsUjMtXFXO1vcKqEdxjXnXtMSCqVI/qGTTeBkzLvmtg9hEeuY03V+p+CqECjiLHcWp4+a7K2pSQjni5u6HeWyAWxn+475DsCspdNtPlsElctJSXOyAIc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DS/2LVNM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DS/2LVNM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9572BC4CEF0; Tue, 12 Aug 2025 17:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755021051; bh=44bJ1M1ir5KNAstPzdm8GAy4SxNxAdlPTjqTN4SqpAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DS/2LVNMawxZ44cHZP1iRqD8uFPOIcjkaWejkSr4yOMBwYxDtcY76UZ2iWipu7icu ekbHVZ037jNQ1wASJLtJGxRcCZHhn8ZLecsxpJ2w37Z+3OadC+M2G/uQ0fz+265b7L ZUUHvq3gkYh58GWpxLb9ZnxgW51D3TknXIovhskQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Salomon Dushimirimana , Damien Le Moal , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.1 204/253] scsi: sd: Make sd shutdown issue START STOP UNIT appropriately Date: Tue, 12 Aug 2025 19:29:52 +0200 Message-ID: <20250812172957.501126319@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250812172948.675299901@linuxfoundation.org> References: <20250812172948.675299901@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Salomon Dushimirimana [ Upstream commit 8e48727c26c4d839ff9b4b73d1cae486bea7fe19 ] 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. Fixes: aa3998dbeb3a ("ata: libata-scsi: Disable scsi device manage_system_start_stop") Signed-off-by: Salomon Dushimirimana Link: https://lore.kernel.org/r/20250724214520.112927-1-salomondush@google.com Tested-by: Damien Le Moal Reviewed-by: Damien Le Moal Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- 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 c3006524eb03..3b481779af35 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3771,7 +3771,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); } -- 2.39.5