Comment 49 for bug 67810

Francesco Pretto (ceztko) wrote :

Fixed in mainstream http://article.gmane.org/gmane.linux.scsi/30489 . Lot of infrastructure here, probably 2.6.22 stuff? Please note that the FULL fix will need shutdown(8) modifies, as described here http://article.gmane.org/gmane.linux.ide/17392 .

In the same message is described a meantime workaround, that consist of a temporary setting (already scheduled for removal) in the libata module. Here the extract:

> This patch implements module parameter libata.spindown_compat which,
> when set to one (default value), prevents libata from spinning down
> disks on shutdown thus avoiding double spinning down. Note that
> libata spins down disks for suspend to mem and disk, so with
> libata.spindown_compat set to one, disks should be properly spun down
> in all cases without modifying shutdown(8).
>
> shutdown(8) should be fixed eventually tho. Some drive do spin up on
> SYNCHRONZE_CACHE even when their cache is clean. Those disks
> currently spin up briefly when sd tries to shutdown the device and
> then the machine powers off immediately, which can't be good for the
> head. We can't skip SYNCHRONIZE_CACHE during shudown as it can be
> dangerous data integrity-wise.
>
> So, this spindown_compat parameter is already scheduled for removal by
> the end of the next year and here's what shutdown(8) should do.
>
> 1. Check whether /sys/modules/libata/parameters/spindown_compat
> exists. If it does, write 0 to it.
>
> For each libata harddisk {
>
> 2. Check whether /sys/class/scsi_disk/h:c:i:l/manage_start_stop
> exists. If so, write 1 to it and continue; otherwise, fall
> through to #3.
>
> 3. Synchronize cache and spin down as before.
>
> }

If i can ask, is there a mainstream for shutdown(8) or it vary between distros?