Red Hat Bugzilla – Bug 454582
Tracker bug for over-eager apps that won't let disks spin down
Last modified: 2015-03-04 20:21:39 EST
Apps which habitually write, and rewrite, and rewrite again the same file over
and over without changes prevent disks from spinning down and thus impact power
use, battery life, etc.
One easy-ish way to find these on an otherwise idle system is:
# sysctl -w vm.block_dump=1
# while true; do sleep 10; date; dmesg -c; done
and see for example:
Tue Jul 8 22:53:35 CDT 2008
ypbind(3241): dirtied inode 33391 (redhat.com.1) on sda11
ypbind(3241): dirtied inode 37462 (redhat.com.2) on sda11
# while true; do sleep 10; date; dmesg -c | grep -v "kjournald\|pdflush"; done
kjournald, pdflush are reactionary...
Oh, just a note; now that relatime isn't on by default anymore, you'd want your root fs mounted noatime for the above test to be useful.
Should bug #491552 be added to this list?
Sounds like a good candidate, yes.
Thanks & regards, Phil
Note that recent udev versions (udev >= 139) will cause a 'change' uevent *every* time a block device opened for writing (e.g. O_WRONLY or O_RDRW) is closed. This 'change' uevent is going to cause vol_id and other tools that investigate the block device to run. Some of the time the sectors needed for vol_id (typically at the beginning and the end of the disk) will be in the page cache but sometimes they are not.
I'd like to stress that this behavior is a *feature*, not a bug: it's how we keep e.g. the desktop icons in sync with whatever you do to a device on the command line (e.g. run mkfs). It's also how we keep persistent device symlinks e.g. /dev/disk/* in sync.
Anyway, what this means is that one important goal in avoiding disk spin downs is to ensure that apps use O_RDONLY as much as possible. As it turns out, a whole bunch of apps get this wrong and open the device with O_RDRW just because they can.
David, interesting. (just caught that latest comment) - can udev report who opened it RDWR?
Can someone please merge the following bugs/mark two of them as duplicate? They are all the same issue (hdparm opening device with O_RDRW instead of O_RDONLY):
bug #494711 - Kernel prevents drive spinning down
bug #507963 - hdparm can't spin down my pata drives
bug #511936 - hdparm / -C wakes up disk?
In addition, the first is incorrectly filed as a kernel bug.
It's trivial to fix BTW (just needs updating to current upstream release).
Just added Bug #515037, I think it belongs in the "depends on" list here.
Jannes, seems so, I've added it (I don't see it on my system but we'll let the other bug sort that out).