Bug 24579 - libatasmart should not wake up disks that are sleeping
Summary: libatasmart should not wake up disks that are sleeping
Status: RESOLVED FIXED
Alias: None
Product: libatasmart
Classification: Unclassified
Component: library (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Lennart Poettering
QA Contact: Lennart Poettering
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-16 14:51 UTC by Snorre Jensen
Modified: 2009-10-27 00:25 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments
devkit-disks-helper-ata-smart-collect output with patched libatasmart (2.26 KB, text/plain)
2009-10-26 03:01 UTC, akaihola
Details
skdump output with patched libatasmart (2.88 KB, text/plain)
2009-10-26 03:03 UTC, akaihola
Details

Description Snorre Jensen 2009-10-16 14:51:29 UTC
All my disks that are inactive (spun down with hdparm -S12 /dev/sd*), are each 30 minutes woken up for a SMART check.

when i run Palimpsest Disk Utility and update now on a disk, I can see this with "ps auxf", and finally found out what is wakening my disks

root      1886  0.0  0.1   4944  2956 ?        S    16:37   0:02 /usr/lib/DeviceKit/devkit-disks-daemon
root      1887  0.0  0.0   4608   684 ?        S    16:37   0:03  \_ devkit-disks-daemon: polling /dev/sdb /dev/hdc /dev/sde /dev/sdc /dev/sdd
root      2570  0.0  0.0   2664   604 ?        D    22:34   0:00  \_ /usr/lib/DeviceKit/devkit-disks-helper-ata-smart-collect /dev/sda 0

running devicekit-disks 007 on Archlinux (gnome 2.28)
Comment 1 David Zeuthen (not reading bugmail) 2009-10-16 15:28:13 UTC
We don't. We specifically use libatasmart API to check if the disk is asleep before attempting retrieving SMART data from it. This works fine for most disks but some disks are broken insofar that checking if they are asleep wakes up the disk. Yes, priceless isn't it?

So this is either a hardware bug (most likely) or a libatatasmart bug (less likely). I'm saying the more is more likely because of the 8 external disks that I own, only one exhibits the behavior your bug is about.

Anyway, not a DeviceKit-disks bug.
Comment 2 David Zeuthen (not reading bugmail) 2009-10-22 08:22:48 UTC
Actually this seems to be a libatasmart bug, see these downstream bug reports

https://bugzilla.redhat.com/show_bug.cgi?id=491552
https://bugs.launchpad.net/ubuntu/+source/libatasmart/+bug/435190

Unfortunately there's no bug tracker for libatasmart yet but I think Lenny wanted one on fd.o. I'll try to get that going, then I'll reassign this bug. Thanks.
Comment 3 David Zeuthen (not reading bugmail) 2009-10-22 08:30:18 UTC
Reassigning to libatasmart.
Comment 4 Rich Rauenzahn 2009-10-22 08:40:23 UTC
I understand that some drives are behaving differently, but I run hddtemp every 2 hours and have smartd polling every 2 hours, and neither utility wakes up my drives.  They both know when they are asleep and they skip their check and log a message saying as much.

Comment 5 Jim Meyering 2009-10-22 08:43:34 UTC
Hi Lenny,
I have one of these disks, too ;-)
Comment 6 Lennart Poettering 2009-10-23 14:46:05 UTC
Not sure who this "Lenny" guy is, I only know a distribution by that name...

But anyway, some guy called Lennart now prepped this patch:

http://git.0pointer.de/?p=libatasmart.git;a=commit;h=a223a4f6277a9f006b722b13671d5292dc6339bb

And I could use someone to test this before I roll a new release tarball for this. Anyone up for this?
Comment 7 Rich Rauenzahn 2009-10-23 14:53:50 UTC
I can test it --- what's the easiest way for me to get a build?  Or build my own?

Fedora 11, 32bit

Rich
Comment 8 Lennart Poettering 2009-10-23 15:09:28 UTC
(In reply to comment #7)
> I can test it --- what's the easiest way for me to get a build?  Or build my
> own?

If building your own would be OK're prefer that. It should be enough to build libatasmart from the git tree and run the dkdisks daemon with LD_LIBRARY_PATH=foobar/libatasmart/.libs/

> Fedora 11, 32bit

Uh, this should be tested with F12. We broke ABI and API of libatasmart between F11 and F12.
Comment 9 Rich Rauenzahn 2009-10-23 15:13:53 UTC
Hmph -- then that takes me out of the test pool!

Rich
Comment 10 Snorre Jensen 2009-10-23 15:30:36 UTC
Good work Lennart! now its working :)

/home/snorre# /usr/lib/DeviceKit/devkit-disks-helper-ata-smart-collect /dev/sda 1
Disk /dev/sda is asleep and nowakeup option was passed
/home/snorre# /usr/lib/DeviceKit/devkit-disks-helper-ata-smart-collect /dev/hda 1
Disk /dev/hda is asleep and nowakeup option was passed
/home/snorre# /usr/lib/DeviceKit/devkit-disks-helper-ata-smart-collect /dev/hdb 1
Disk /dev/hdb is asleep and nowakeup option was passed
Comment 11 Lennart Poettering 2009-10-23 15:47:33 UTC
(In reply to comment #10)
> Good work Lennart! now its working :)
> 
> /home/snorre# /usr/lib/DeviceKit/devkit-disks-helper-ata-smart-collect /dev/sda
> 1
> Disk /dev/sda is asleep and nowakeup option was passed
> /home/snorre# /usr/lib/DeviceKit/devkit-disks-helper-ata-smart-collect /dev/hda
> 1
> Disk /dev/hda is asleep and nowakeup option was passed
> /home/snorre# /usr/lib/DeviceKit/devkit-disks-helper-ata-smart-collect /dev/hdb
> 1
> Disk /dev/hdb is asleep and nowakeup option was passed
> 

Now we know that the wakeup situatin got fixed. But does reading the SMART data work as well, i.e. are there any regressions? Could you verify that please?
Comment 12 Snorre Jensen 2009-10-23 16:03:36 UTC
I run: 
# /usr/lib/DeviceKit/devkit-disks-helper-ata-smart-collect /dev/sda 0
then the disk spins up and I get this error: 
Failed to read smart data for /dev/sda: No such file or directory
Comment 13 Snorre Jensen 2009-10-23 16:05:23 UTC
On Fri, 23 Oct 2009 15:47:34 -0700 (PDT)
bugzilla-daemon@freedesktop.org wrote:

> http://bugs.freedesktop.org/show_bug.cgi?id=24579
> 
> 
> 
> 
> 
> --- Comment #11 from Lennart Poettering <lennart@poettering.net>
> 2009-10-23 15:47:33 PST --- (In reply to comment #10)
> > Good work Lennart! now its working :)
> > 
> > /home/snorre# /usr/lib/DeviceKit/devkit-disks-helper-ata-smart-collect /dev/sda
> > 1
> > Disk /dev/sda is asleep and nowakeup option was passed
> > /home/snorre# /usr/lib/DeviceKit/devkit-disks-helper-ata-smart-collect /dev/hda
> > 1
> > Disk /dev/hda is asleep and nowakeup option was passed
> > /home/snorre# /usr/lib/DeviceKit/devkit-disks-helper-ata-smart-collect /dev/hdb
> > 1
> > Disk /dev/hdb is asleep and nowakeup option was passed
> > 
> 
> Now we know that the wakeup situatin got fixed. But does reading the
> SMART data work as well, i.e. are there any regressions? Could you
> verify that please?
> 
> 
I run: 
# /usr/lib/DeviceKit/devkit-disks-helper-ata-smart-collect /dev/sda 0
then the disk spins up and I get this error: 
Failed to read smart data for /dev/sda: No such file or directory
Comment 14 akaihola 2009-10-26 03:01:21 UTC
Created attachment 30689 [details]
devkit-disks-helper-ata-smart-collect output with patched libatasmart

Lennart,

The patch fixed the spin-up problem on my Ubuntu 9.10 Alpha 6 box. Here's the output from devkit-disks-helper-ata-smart-collect when the drive is spun down, first with nowakeup=1, then nowakeup=0.

I installed the patched libatasmart from Martin Pitt's Ubuntu PPA: https://launchpad.net/~ubuntu-desktop/+archive/ppa
Comment 15 akaihola 2009-10-26 03:03:35 UTC
Created attachment 30690 [details]
skdump output with patched libatasmart

Here's skdump output for my disk with the patched libatasmart. I haven't compared it to the output before installing the patch, but all values seem valid.
Comment 16 Lennart Poettering 2009-10-26 19:06:55 UTC
Everything looks good then. I'll consider this bug fixed.
Comment 17 Martin Pitt 2009-10-27 00:25:23 UTC
There was another positive testing response on the downstream lp bug. Thanks for fixing!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.