linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris <email.bug@arcor.de>
To: 779412@bugs.debian.org
Cc: 725284@bugs.debian.org, linux-raid@vger.kernel.org,
	smartmontools-support@lists.sourceforge.net
Subject: block devices loosing state after resume: trigger udev rules to re-apply settings
Date: Sat, 28 Feb 2015 09:30:23 +0100	[thread overview]
Message-ID: <20150228093023.14e30d9a@smtp.arcor.de> (raw)

(http://bugs.debian.org/779412 explanation)

There is a general problem with non-permanent block devices settings
(hard disks, optical disks, usb storage, ...), that are not restored 
when resuming from suspend (instead using factory defaults and 
loosing all pre-suspend settings).

And as long as the ata/scsi command set drivers can not save and
restore every state register a device may have (impossible?),
systemd may ship a viable workaround for this:

A systemd unit file could trigger an udev change action upon resume for
block devices. This way the same udev rules that set up the devices when
they are first plugged, will re-apply their settings after resume.

Providing this centrally with the systemd package could avoid that 
multiple packages ship their own files, resulting in multiple change 
events triggerd on each resume.

Examples for very important (non-permanent) settings are with
hdparm (i.e. the important -B hard disk wear settings)
https://bugs.debian.org/725284
smartctl/mdadm/lvm/btrfs/zfs/... (i.e. set error recovery timeouts to
prevent controller resets and data loss)
http://sourceforge.net/p/smartmontools/mailman/message/33501936/




A draft for such a central systemd unit file:

[Unit]
Description=Trigger all block device udev rules on resume, to re-apply all non-permanent device settings (e.g. smartctl and hdparm rules).
After=suspend.target After=hibernate.target
After=hybrid-sleep.target

[Service]
Type=oneshot
ExecStart=/sbin/udevadm trigger --action=change --subsystem-match=block

[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target


             reply	other threads:[~2015-02-28  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-28  8:30 Chris [this message]
2015-02-28  8:38 ` Bug#725284: Bug#779412: block devices loosing state after resume: trigger udev rules to re-apply settings Michael Biebl
2015-02-28  9:47   ` Chris

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=20150228093023.14e30d9a@smtp.arcor.de \
    --to=email.bug@arcor.de \
    --cc=725284@bugs.debian.org \
    --cc=779412@bugs.debian.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=smartmontools-support@lists.sourceforge.net \
    /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 NNTP newsgroup(s).