public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Linux should better cope with power failure
@ 2001-03-19 22:35 Otto Wyss
  2001-03-19 23:12 ` John R Lenton
  0 siblings, 1 reply; 29+ messages in thread
From: Otto Wyss @ 2001-03-19 22:35 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org

Jeremy Jackson wrote:
> 
> Brian Gerst wrote:
> 
> > "Richard B. Johnson" wrote:
> > >
> > > On Mon, 19 Mar 2001, Otto Wyss wrote:
> > >
> > > > Lately I had an USB failure, leaving me without any access to my system
[..]
> > > Unix and other such variants have what's called a Virtual File System
> > > (VFS).  The idea behind this is to keep as much recently-used file stuff
> > > in memory so that the system can be as fast as if you used a RAM disk
> > > instead of real physical (slow) hard disks. If you can't cope with this,
> > > use DOS.
> >
> > At the very least the disk should be consistent with memory.  If the
> > dirty pages aren't written back to the disk (but not necessarily removed
> > from memory) after a reasonable idle period, then there is room for
> > improvement.
> 
> They are.   If you leave your machine one for a minute or so (probably less is ok,
> but I don't know) the kernel will flush dirty buffers... fsck will complain, but the
> file's

There was at least 15min I waited without doing anything (how could I
without any imput device). I was editing a file with vim and the usual
bunch of demons where running mostly doing nothing. I don't know if all
the complains from fsck where due to open files or dirty cache pages. I
wouldn't complain if there was any heavy activity but there was allmost none.

> *data* blocks will be on the disk.  There are way more reasons that this is a silly
> and annoying thread.  You should read more about things like
> asynchronous/synchronous filesystems,
> lazy-write cacheing, etc, etc,.  If you know how to write software and/or configure
> your system,
> you can avoid all of these problems.  Or use a journaling filesystem ext3/xfs, etc.
> But I tire of this...

So in real live you would propose to put fences and nets everywhere to
prevent children from possibly falling in abyses?

O. Wyss

^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: Linux should better cope with power failure
@ 2001-03-23 15:28 David Balazic
  2001-03-23 18:22 ` Gerhard Mack
  2001-03-23 19:29 ` Otto Wyss
  0 siblings, 2 replies; 29+ messages in thread
From: David Balazic @ 2001-03-23 15:28 UTC (permalink / raw)
  To: otto.wyss, linux-kernel

I had a similar experience: 
X crashed , hosing the console , so I could not initiate
a proper shutdown.

Here I must note that the response you got on linux-kernel is
shameful.

What I did was to write a kernel/apmd patch , that performed a
proper shutdown when I press the power button ( which luckily
works as long as the kernel works ).

Ask me for details, if interested.
The patch was for 2.2.x IIRC, so I would have to rewrite it almost
from scratch.


Otto Wyss (otto.wyss@bluewin.ch) wrote :

> Lately I had an USB failure, leaving me without any access to my system 
> since I only use an USB-keyboard/-mouse. All I could do in that 
> situation was switching power off and on after a few minutes of 
> inactivity. From the impression I got during the following startup, I 
> assume Linux (2.4.2, EXT2-filesystem) is not very suited to any power 
> failiure or manually switching it off. Not even if there wasn't any 
> activity going on. 
> 
> Shouldn't a good system allways try to be on the save side? Shouldn't 
> Linux try to be more fail save? There is currently much work done in 
> getting high performance during high activity but it seems there is no 
> work done at all in getting a save system during low/no activity. I 
> think this is a major drawback and should be addressed as fast as 
> possible. Bringing a system to save state should allway have a high priority. 
> 
> How could this be accomplished: 
> 1. Flush any dirty cache pages as soon as possible. There may not be any 
> dirty cache after a certain amount of idle time. 
> 2. Keep open files in a state where it doesn't matter if they where 
> improperly closed (if possible). 
> 3. Swap may not contain anything which can't be discarded. Otherwise 
> swap has to be treated as ordinary disk space. 
> 
> These actions are not filesystem dependant. It might be that certain 
> filesystem cope better with power failiure than others but still it's 
> much better not to have errors instead to fix them. 
> 
> Don't we tell children never go close to any abyss or doesn't have 
> alpinist a saying "never go to the limits"? So why is this simple rule 
> always broken with computers? 
> 
> O. Wyss 

-- 
David Balazic
--------------
"Be excellent to each other." - Bill & Ted
- - - - - - - - - - - - - - - - - - - - - -

^ permalink raw reply	[flat|nested] 29+ messages in thread
* RE: Linux should better cope with power failure
@ 2001-03-19 22:11 Stephen Gutknecht (linux-kernel)
  2001-03-19 22:39 ` Otto Wyss
  0 siblings, 1 reply; 29+ messages in thread
From: Stephen Gutknecht (linux-kernel) @ 2001-03-19 22:11 UTC (permalink / raw)
  To: 'otto.wyss@bluewin.ch', linux-kernel

Otto,

If you are doing development work (or playing with new kernels) and things
like USB failures lock you from keyboard and mouse...

Have you considered telnet into your box from a second machine?  Even a 486
system would do this fine... network cards are cheap.  You could try to
recover the system or at least do a shutdown.

Maybe there are reason you have ruled this out; just making sure you haven't
overlooked a possible prevention solution.

  Stephen Gutknecht
  Renton, Washington
  http://www.RoundSparrow.com/


-----Original Message-----
From: Otto Wyss [mailto:otto.wyss@bluewin.ch]
Sent: Monday, March 19, 2001 11:47 AM
To: linux-kernel@vger.kernel.org
Subject: Linux should better cope with power failure


Lately I had an USB failure, leaving me without any access to my system
since I only use an USB-keyboard/-mouse. All I could do in that
situation was switching power off and on after a few minutes of
inactivity. From the impression I got during the following startup, I
assume Linux (2.4.2, EXT2-filesystem) is not very suited to any power
failiure or manually switching it off. Not even if there wasn't any
activity going on. 
[snip]

^ permalink raw reply	[flat|nested] 29+ messages in thread
* RE: Linux should better cope with power failure
@ 2001-03-19 21:16 Torrey Hoffman
  2001-03-19 22:28 ` Stephen Satchell
  0 siblings, 1 reply; 29+ messages in thread
From: Torrey Hoffman @ 2001-03-19 21:16 UTC (permalink / raw)
  To: 'otto.wyss@bluewin.ch', linux-kernel


Otto Wyss wrote:
> situation was switching power off and on after a few minutes of
> inactivity. From the impression I got during the following startup, I

You aren't giving a lot of detail here.  I assume your startup scripts run
fsck, and you saw a lot of errors.  Were any of them uncorrectable?  

> assume Linux (2.4.2, EXT2-filesystem) is not very suited to any power
> failiure or manually switching it off. Not even if there wasn't any
> activity going on. 

That is correct.  Pulling the plug on non-journaled filesystems is a
bad idea.

> Shouldn't a good system allways try to be on the save side? 

Yes.  Some of this is your responsibility.  You have several options:
1. Get a UPS.  That would not have helped your particular problem,
   but it's a good idea if you care about data integrity.
2. Use a journaling file system.  These are much more tolerant of
   abuse.  Reiserfs seems to work for me on embedded systems I am
   building where the user can (and does) remove the power any time.
3. Use RAID.  Hard drives are very cheap and software raid is very 
   easy to set up.

> There is currently much work done in
> getting high performance during high activity but it seems there is no
> work done at all in getting a save system during low/no activity. 

Actually, a lot of work _is_ being done on journaling file systems
which help solve this problem.  Current journaling file systems are
metadata only, but Tux2 (if I understand it) will journal everything.

> How could this be accomplished:
> 1. Flush any dirty cache pages as soon as possible. There may 
> not be any
> dirty cache after a certain amount of idle time.

This can be done from user space.  The simple approach would be to set up a
cron job to sync and flush buffers every "n" seconds.  A smarter approach
would examine the load average, and not sync if the load was high.  This
does not need to be in the kernel.

> 2. Keep open files in a state where it doesn't matter if they where
> improperly closed (if possible).

This is mostly a user space problem as well.  It has been solved for
editors which automatically save files every "n" minutes.   I don't know
if it can be solved from kernel space - if applications leave files in
an inconsistent state, how can the kernel possibly do anything about it?

> 3. Swap may not contain anything which can't be discarded. Otherwise
> swap has to be treated as ordinary disk space.

I'm not an expert, but I don't think this is relevant?

> Don't we tell children never go close to any abyss or doesn't have
> alpinist a saying "never go to the limits"? So why is this simple rule
> always broken with computers?

So were you breaking this rule?  Were you using a journaling file system,
or RAID, or a UPS?  

Torrey Hoffman

^ permalink raw reply	[flat|nested] 29+ messages in thread
* Linux should better cope with power failure
@ 2001-03-19 19:46 Otto Wyss
  2001-03-19 19:59 ` Charles Cazabon
                   ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: Otto Wyss @ 2001-03-19 19:46 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org

Lately I had an USB failure, leaving me without any access to my system
since I only use an USB-keyboard/-mouse. All I could do in that
situation was switching power off and on after a few minutes of
inactivity. From the impression I got during the following startup, I
assume Linux (2.4.2, EXT2-filesystem) is not very suited to any power
failiure or manually switching it off. Not even if there wasn't any
activity going on. 

Shouldn't a good system allways try to be on the save side? Shouldn't
Linux try to be more fail save? There is currently much work done in
getting high performance during high activity but it seems there is no
work done at all in getting a save system during low/no activity. I
think this is a major drawback and should be addressed as fast as
possible. Bringing a system to save state should allway have a high priority.

How could this be accomplished:
1. Flush any dirty cache pages as soon as possible. There may not be any
dirty cache after a certain amount of idle time.
2. Keep open files in a state where it doesn't matter if they where
improperly closed (if possible).
3. Swap may not contain anything which can't be discarded. Otherwise
swap has to be treated as ordinary disk space.

These actions are not filesystem dependant. It might be that certain
filesystem cope better with power failiure than others but still it's
much better not to have errors instead to fix them. 

Don't we tell children never go close to any abyss or doesn't have
alpinist a saying "never go to the limits"? So why is this simple rule
always broken with computers?

O. Wyss

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

end of thread, other threads:[~2001-03-26 10:23 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-19 22:35 Linux should better cope with power failure Otto Wyss
2001-03-19 23:12 ` John R Lenton
  -- strict thread matches above, loose matches on Subject: below --
2001-03-23 15:28 David Balazic
2001-03-23 18:22 ` Gerhard Mack
2001-03-26  9:34   ` David Balazic
2001-03-23 19:29 ` Otto Wyss
2001-03-23 22:41   ` David Ford
2001-03-24  8:44     ` Otto Wyss
2001-03-24  9:47       ` David Ford
2001-03-24 10:28         ` Otto Wyss
2001-03-26 10:22     ` David Balazic
2001-03-26 10:17   ` David Balazic
2001-03-19 22:11 Stephen Gutknecht (linux-kernel)
2001-03-19 22:39 ` Otto Wyss
2001-03-20 21:38   ` H. Peter Anvin
2001-03-19 21:16 Torrey Hoffman
2001-03-19 22:28 ` Stephen Satchell
2001-03-19 23:05   ` Andre Hedrick
2001-03-19 19:46 Otto Wyss
2001-03-19 19:59 ` Charles Cazabon
2001-03-19 20:15 ` Richard B. Johnson
2001-03-19 20:51   ` Brian Gerst
2001-03-19 21:08     ` Jeremy Jackson
2001-03-19 21:35     ` Richard B. Johnson
2001-03-19 21:59       ` Brian Gerst
2001-03-19 22:15       ` Jeremy Jackson
2001-03-19 15:14         ` Ben Ford
2001-03-19 23:07   ` Werner Almesberger
2001-03-19 20:19 ` William T Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox