Re: [Pkg-sysvinit-devel] [PATCH] libata: remove libata.spindown_compat
On Thu, 2007-05-17 at 16:43 +0200, Tejun Heo wrote: I'll attach the updated version of http://linux-ata.org/shutdown.html as a reply to this mail. It says: When a disk is powered off, it needs to flush its write cache and then unload its heads so that they don't crash onto the recording surfaces. Most disks have mechanical mechanism to unload its heads even when power is abruptly cut. This is usually called emergency unload and causes popping sound on some disks and may have negative effect on the lifetime of the disk, so the operating system must tell the disks to unload the heads prior to shutting the system down. In ATA, this is achieved by issuing FLUSH CACHE followed by STANDBYNOW and the IDE drivers (drivers/ide/*) have always issued the sequence prior to powering off. libata uses SCSI sd driver as its high level disk driver and the sd driver, unfortunately, issues only the cache flush command during shutdown. This is mainly because SCSI disks can be accessed by multiple initiators (hosts) and spinning down disks because one initiator goes down can disturb others. Because of this implementation detail, libata drivers up to kernel version 2.6.21 don't issue the STANDBYNOW command before powering off. This is not quite correct. The reason halt(8) spins down IDE disks is that, way back when (november 2001 I guess, from the changelog), the IDE drivers did not flush the cache on poweroff. The result was that on some machines, poweroff was so fast that the power of the drive got turned off while it still had some unflushed data in the write-cache, resulting in filesystem corruption. This problem did not exist with SCSI, apparently. To fix this issue, halt(8) started issueing WIN_STANDBYNOW1 (0xE0) and WIN_STANDBYNOW2 (0x94) ioctls before halt and poweroff, as that was more reliable than flush cache and the effect was the same. Mike. - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Pkg-sysvinit-devel] [PATCH] libata: remove libata.spindown_compat
On Sat, 19 May 2007, Tejun Heo wrote: To fix this issue, halt(8) started issueing WIN_STANDBYNOW1 (0xE0) and WIN_STANDBYNOW2 (0x94) ioctls before halt and poweroff, as that was more reliable than flush cache and the effect was the same. One culprit there is that, according to the spec, STANDBYNOW doesn't necessarily imply cache flush and AFAIK issuing STANDBYNOW to libata devices is to avoid emergency unload. Can you comment on this Henrique? Well, the reason I raised the ruckus in the first place was just the emergency unload, yes. I didn't know about any missing cache flushes (and AFAIK we never had any reported to us). We will have to fix that in halt(8) IMHO, just in case. And probably hdparm/sdparm should also know to not standby or sleep disks without a cache flush, either. I also don't know the history of halt(8), Miquel does... so I have not much else to comment. At least now it is clear what we need halt(8) to do (in Debian, anyway): 1. check if we have a responsible kernel or not through sysfs. 1a: kernel is responsible, and can spin down disks at shutdown - if given -h on command line, use sysfs to tell kernel to spin down *all* disk devices we can find in sysfs, and don't send any taskfiles or IOCTLs to the disks. 1b: kernel is missing this essential feature - keep doing what we are doing now, but issue a cache flush before we send any standby commands. 2. push that to Debian unstable, and also to stable-proposed-updates, or at the very least to backports.org. This will give maximum compatibility with the kernel, and fix the cache-not-flushed-before-spindown issue. -- One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie. -- The Silicon Valley Tarot Henrique Holschuh - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Pkg-sysvinit-devel] [PATCH] libata: remove libata.spindown_compat
Henrique de Moraes Holschuh wrote: Well, the reason I raised the ruckus in the first place was just the emergency unload, yes. I didn't know about any missing cache flushes (and AFAIK we never had any reported to us). We will have to fix that in halt(8) IMHO, just in case. And probably hdparm/sdparm should also know to not standby or sleep disks without a cache flush, either. I also don't know the history of halt(8), Miquel does... so I have not much else to comment. OIC, hmm.. STANDBYNOW for cache flushing. Interesting. At least now it is clear what we need halt(8) to do (in Debian, anyway): 1. check if we have a responsible kernel or not through sysfs. 1a: kernel is responsible, and can spin down disks at shutdown - if given -h on command line, use sysfs to tell kernel to spin down *all* disk devices we can find in sysfs, and don't send any taskfiles or IOCTLs to the disks. 1b: kernel is missing this essential feature - keep doing what we are doing now, but issue a cache flush before we send any standby commands. 2. push that to Debian unstable, and also to stable-proposed-updates, or at the very least to backports.org. This will give maximum compatibility with the kernel, and fix the cache-not-flushed-before-spindown issue. Yeap, right. It would be great if you can push the updates upstream so that other distros can use it too. Also, some configurations might prefer halt not touching the sysfs nodes so that the user can configure mange_start_stop, but I guess that kind of stuff is up to distro. Thanks. -- tejun - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html