linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* disk write cache and poweroff
@ 2001-11-12 12:41 Miquel van Smoorenburg
  2001-11-12 17:18 ` Andre Hedrick
  0 siblings, 1 reply; 2+ messages in thread
From: Miquel van Smoorenburg @ 2001-11-12 12:41 UTC (permalink / raw)
  To: Andre Hedrick; +Cc: linux-kernel

Hello Andre,

A few users of the debian sysvinit package have complained that on
their laptop, shutdown + poweroff is too fast. The disk is turned
off before the write-cache on the disk is completely written,
resulting in some filesystem corruption.

After some experimentation with turning off the write cache before
shutdown etc, I found out that a side-effect of putting the IDE
disk in standby mode is that the write cache is flushed. So now
halt(8) has an extra option to put all IDE disks it can find
(through /proc/ide/hd*) in standby mode just before it calls
reboot(LINUX_REBOOT_CMD_POWER_OFF). Thus flag is used in the
/etc/rc0.d/S90halt script, and appears to fix the problem. I think
windows does the same :|

Anyway this should probably be done in the kernel. Perhaps the
IDE driver should register a reboot notifier with
register_reboot_notifier() that puts all IDE disks on the
system in standby mode on SYS_HALT and SYS_POWER_OFF ?

Many other drivers do this too, grep for SYS_HALT in linux/drivers/*/*.c

Hmm I just noticed that a lot of driver check for SYS_DOWN (which
is the same as SYS_RESTART: reboot) and SYS_HALT but not for
SYS_POWEROFF, which is a bug in those drivers. Ugh.

Mike.
-- 
"Only two things are infinite, the universe and human stupidity,
 and I'm not sure about the former" -- Albert Einstein.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: disk write cache and poweroff
  2001-11-12 12:41 disk write cache and poweroff Miquel van Smoorenburg
@ 2001-11-12 17:18 ` Andre Hedrick
  0 siblings, 0 replies; 2+ messages in thread
From: Andre Hedrick @ 2001-11-12 17:18 UTC (permalink / raw)
  To: linux-kernel


Miquel,

Please use the latest patches found at www.linuxdiskcert.org.

Cheers,

Andre Hedrick
CEO/President, LAD Storage Consulting Group
Linux ATA Development
Linux Disk Certification Project

On Mon, 12 Nov 2001, Miquel van Smoorenburg wrote:

> Hello Andre,
> 
> A few users of the debian sysvinit package have complained that on
> their laptop, shutdown + poweroff is too fast. The disk is turned
> off before the write-cache on the disk is completely written,
> resulting in some filesystem corruption.
> 
> After some experimentation with turning off the write cache before
> shutdown etc, I found out that a side-effect of putting the IDE
> disk in standby mode is that the write cache is flushed. So now
> halt(8) has an extra option to put all IDE disks it can find
> (through /proc/ide/hd*) in standby mode just before it calls
> reboot(LINUX_REBOOT_CMD_POWER_OFF). Thus flag is used in the
> /etc/rc0.d/S90halt script, and appears to fix the problem. I think
> windows does the same :|
> 
> Anyway this should probably be done in the kernel. Perhaps the
> IDE driver should register a reboot notifier with
> register_reboot_notifier() that puts all IDE disks on the
> system in standby mode on SYS_HALT and SYS_POWER_OFF ?
> 
> Many other drivers do this too, grep for SYS_HALT in linux/drivers/*/*.c
> 
> Hmm I just noticed that a lot of driver check for SYS_DOWN (which
> is the same as SYS_RESTART: reboot) and SYS_HALT but not for
> SYS_POWEROFF, which is a bug in those drivers. Ugh.
> 
> Mike.
> -- 
> "Only two things are infinite, the universe and human stupidity,
>  and I'm not sure about the former" -- Albert Einstein.
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-11-12 16:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-12 12:41 disk write cache and poweroff Miquel van Smoorenburg
2001-11-12 17:18 ` Andre Hedrick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).