Re: Avoid ext2/FAT panic on media error ?

Theodore Y. Ts'o (tytso@MIT.EDU)
Fri, 1 Aug 1997 22:36:03 -0400


From: Jochen Karrer <karrer@wpfd25.physik.uni-wuerzburg.de>
Date: Fri, 1 Aug 1997 12:26:30 +0200 (MET DST)

ext2 (and FAT) filesystem is still totally unusuable
for removeable media like ZIP-disks because
a kernel panic will occur when using
a defective disk even if the error behaviour is set to
"remount read only" or to "continue". This forces me
to reboot the machine. This happens because ext2_panic()
is called, if a inode can not be read. I substituted
this with a call to ext2_error(). But unfortunately I don't
know if there are any side effects when continuing without
reading a valid block. So please send me your comments on
the patch below. The patch is for 2.1.47. But 2.0.30 has
the same problem.

Yes, this is a known problem, which in all honesty has been left unfixed
for too long. Unfortunately everyone who's known about it has been too
busy with other things. :-(

Your patch is probably better than the current behaviour, although
continueing isn't always the safest thing in the world.

What I would have the patch do instead is have the routine call
ext2_error instead of ext2_panic. That way, it's configurable on a
per-filesystem basis whether or to panic, remoute the filesystem
read-only, or continue.

The other major change I would make is that if the ext2 fs is going to
remount the filesystem read-only or is going to simply continue, the
error should really be passed up the call chain to the fs layer, so that
the user application can be properly notified that its open call failed.

Right now, read_inode and write_inode in the superblock_operations
structure return void, so we would need to change that, and then add the
appropriate error checking to the fs layer and all of the other places
which call read_inode and write_inode.

Jochen, do you think you'd be up to making the changes? I'll be willing
commit to helping you out with the changes if you'd be willing to try to
do the work.

- Ted