Bug 769059

Summary: spindown doesn't spin down after waking from suspend
Product: [Fedora] Fedora Reporter: Ville Skyttä <ville.skytta>
Component: spindownAssignee: Martin Cermak <mcermak>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 16CC: hdegoede, mcermak
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spindown-0.4.0-5.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 787231 (view as bug list) Environment:
Last Closed: 2012-03-01 09:20:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 787231    

Description Ville Skyttä 2011-12-19 19:34:12 UTC
spindown doesn't spin down disks after waking from suspend.

1) Start spindown
2) Wait for it to spin down disks
3) Suspend
4) Resume
5) spindown no longer spins down disks that were spun up when resuming, it doesn't seem to be doing anything whatsoever any more

Marking as high severity because at least for me, the only reason for potentially wanting to use spindown over a simple "hdparm -S" call in let's say rc.local is that it'd work after suspend/resume.  I've verified that after resuming from suspend, hdparm -y does put the drive to sleep and it doesn't wake up, so I'd say this isn't because something's keeping the disk awake.

I see there's a "repeat" parameter documented at http://code.google.com/p/spindown/wiki/Configuration which I haven't tried, mainly because I fail to see what good would spindown then be over just invoking hdparm -y repeatedly from cron.  The /etc/spindown.conf I'm testing with is included below.

[General]
cycle-time = 60
idle-time = 60
syslog = 1

[Disk 0]
id = scsi-SATA_SAMSUNG_SP2504CS09QJ1UYC38506
spindown = 1
command = hdparm -y

Comment 1 Martin Cermak 2012-01-02 15:56:52 UTC
You're right. Using your config file I'm able to reproduce the issue. 

> I see there's a "repeat" parameter documented at
> http://code.google.com/p/spindown/wiki/Configuration which I haven't tried,
> mainly because I fail to see what good would spindown then be over just
> invoking hdparm -y repeatedly from cron.  The /etc/spindown.conf I'm testing
> with is included below.

Yes, you can use "repeat = 1" to work around your problem: 

As you can see in Spindown::spinDownIdleDisks(), the daemon periodically checks a condition similar to this one: disk->idleTime() >= disk->spinDownTime(). 

By default (repeat = 0) the spindown command is called just for the first time this condition is met. With "repeat = 1", the spindown command is called repeatedly each time that condition is met. This resolves your issue.

Closing as NOTABUG. Feel free to reopen if your problem persists.

Comment 2 Martin Cermak 2012-01-03 07:47:08 UTC
> I see there's a "repeat" parameter documented at
> http://code.google.com/p/spindown/wiki/Configuration which I haven't tried,
> mainly because I fail to see what good would spindown then be over just
> invoking hdparm -y repeatedly from cron.

I can understand this is not ideal solution, but this is the way the upstream code works. Better solution could probably be based on a hook in /etc/pm/sleep.d. If you like, please file a new request for feature [rfe] against spindown and I can elaborate on this.

Comment 3 Fedora Update System 2012-02-02 10:21:58 UTC
spindown-0.4.0-4.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/spindown-0.4.0-4.fc16

Comment 4 Martin Cermak 2012-02-02 10:27:53 UTC
> Better solution could probably be based on a hook in /etc/pm/sleep.d. 

Here I come with such a solution.

Comment 5 Fedora Update System 2012-02-02 17:24:23 UTC
Package spindown-0.4.0-4.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing spindown-0.4.0-4.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-1177/spindown-0.4.0-4.fc16
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2012-02-10 21:58:34 UTC
spindown-0.4.0-4.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Ville Skyttä 2012-02-18 11:33:26 UTC
(In reply to comment #4)
> Here I come with such a solution.

I think using "systemctl restart" here is not correct as it will start spindown even if it was not running; try-restart should be used instead, no?

Comment 8 Fedora Update System 2012-02-20 14:17:19 UTC
spindown-0.4.0-5.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/spindown-0.4.0-5.fc16

Comment 9 Martin Cermak 2012-02-20 14:20:45 UTC
Right you are, definitely. Thanks for the response. Please, review the fix and consider giving some karma to the package. Thanks.

Comment 10 Ville Skyttä 2012-02-20 20:21:29 UTC
Done, the F-16 update seems to work for me.  But the F-17 and rawhide versions still seem to be doing "systemctl restart".

Comment 11 Fedora Update System 2012-02-21 01:34:13 UTC
Package spindown-0.4.0-5.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing spindown-0.4.0-5.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-2086/spindown-0.4.0-5.fc16
then log in and leave karma (feedback).

Comment 12 Martin Cermak 2012-02-21 08:46:49 UTC
> the F-17 and rawhide versions still seem to be doing "systemctl restart".

I know; related bz787231 is already reopened. Going to fix that too..

Comment 13 Fedora Update System 2012-03-01 09:20:51 UTC
spindown-0.4.0-5.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.