Linux-ide Archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Damien Le Moal <dlemoal@kernel.org>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH v3] scsi: sd: Introduce manage_shutdown device flag
Date: Thu, 26 Oct 2023 11:32:52 +0200	[thread overview]
Message-ID: <2ad32008-cbcf-4927-b37d-45b933f47177@suse.de> (raw)
In-Reply-To: <20231026090748.130959-1-dlemoal@kernel.org>

On 10/26/23 11:07, Damien Le Moal wrote:
> Commit aa3998dbeb3a ("ata: libata-scsi: Disable scsi device
> manage_system_start_stop") change setting the manage_system_start_stop
> flag to false for libata managed disks to enable libata internal
> management of disk suspend/resume. However, a side effect of this change
> is that on system shutdown, disks are no longer being stopped (set to
> standby mode with the heads unloaded). While this is not a critical
> issue, this unclean shutdown is not recommended and shows up with
> increased smart counters (e.g. the unexpected power loss counter
> "Unexpect_Power_Loss_Ct").
> 
> Instead of defining a shutdown driver method for all ATA adapter
> drivers (not all of them define that operation), this patch resolves
> this issue by further refining the sd driver start/stop control of disks
> using the new flag manage_shutdown. If this new flag is set to true by
> a low level driver, the function sd_shutdown() will issue a
> START STOP UNIT command with the start argument set to 0 when a disk
> needs to be powered off (suspended) on system power off, that is, when
> system_state is equal to SYSTEM_POWER_OFF.
> 
> Similarly to the other manage_xxx flags, the new manage_shutdown flag is
> exposed through sysfs as a read-write device attribute.
> 
> To avoid any confusion between manage_shutdown and
> manage_system_start_stop, the comments describing these flags in
> include/scsi/scsi.h are also improved.
> 
> Fixes: aa3998dbeb3a ("ata: libata-scsi: Disable scsi device manage_system_start_stop")
> Cc: stable@vger.kernel.org
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218038
> Link: https://lore.kernel.org/all/cd397c88-bf53-4768-9ab8-9d107df9e613@gmail.com/
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
> ---
> Changes from v2:
>   * Fixed typo in the comments added to include/scsi/scsi_device.h
>   * Added Niklas's review tag
> Changes from v1:
>   * Improved flags description in include/scsi/scsi_device.h
>   * Added missing sysfs export of manage_shutdown
> 
>   drivers/ata/libata-scsi.c  |  5 +++--
>   drivers/firewire/sbp2.c    |  1 +
>   drivers/scsi/sd.c          | 39 +++++++++++++++++++++++++++++++++++---
>   include/scsi/scsi_device.h | 20 +++++++++++++++++--
>   4 files changed, 58 insertions(+), 7 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman


      reply	other threads:[~2023-10-26  9:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26  9:07 [PATCH v3] scsi: sd: Introduce manage_shutdown device flag Damien Le Moal
2023-10-26  9:32 ` Hannes Reinecke [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ad32008-cbcf-4927-b37d-45b933f47177@suse.de \
    --to=hare@suse.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).