Re: Floppy problem

Alain Knaff (alknaff@innet.lu)
Sun, 22 Dec 1996 10:30:53 +0100


>
>(This is more rehashing the floppy drive problem.)
>
>On Sun, 22 Dec 1996, Peter T. Breuer wrote:
>
>> I can tell you that I am using 2.0.25, and that last week - in the
>> course of looking at 100+ students work on floppy - I forgot to umount
>> fd0 at least ten times before mecahnically ejecting the diskette. No
>> problem. I don't think I ever put a new floppy in, or at least never
>> mounted it, before remembering that I was one umount behind where I
>> should be, but I still never had anything approaching a panic. Just
>> a polite note from mount once or twice to remind me that the drive was
>> already mounted.
>
>Yes, you can do all sorts of gyrations with the disk. You have to do
>exactly what I described to be hit by a panic: change the disk for
>another and then access the disk. Any other fooling around accomplishes
>nil. Actually, accessing the disk while it is removed will yield the
>affected floppy unit useless and a D state process.

The type of the mounted filesystem may also be important. When a
disk is removed when mounted, the floppy driver has not many choices
except to report to the upper layers (filesystem code) that there is a
problem. Some filesystems (minix ?) seem to not handle this situation
gracefully, and panic if they get any errors. Others (ext2 ?) do it
the correct way, and just remount themselves readonly if a "fatal"
error occurs. This prevents further corruption to the disk, but still
allows the user to work with other parts of the system.

For this reason, it would be useful if people experiencing these
kinds of bugs would prominently mention the name of the _filesystem_
that was used in the "Subject" line of the message, so as to attract
the interest of the right people.

>> I must say that I think ejecting the disk ought to magically umount the
>> drive! Can this be done via kerneld? It seems not - it's all wrong.
>> The kernel gets notified but not via a demand for a device ...
>
>Can't. The floppy drive hardware is backward and stupid. It does not
>notify when a disk is removed, it notifies (if you check!!) if a disk
>change has occurred.

The problem is actually deeper than that: even if the drive notified
the kernel when (i.e. after) removing the disk, the kernel could not
do anything about it, as at that time the disk is no longer there to
write any dirty buffers out that could be there. Syquest and ZIP (?)
disks don't have these problem: These drives have a lockable or
motorized eject, which gives the kernel the occasion to tell the drive
"hold on a moment, until I have saved the data".

However, there is a package called fdmount in my fdutils package,
which attempts to do secure automatic mounting/automatic mounting
using synchronous mounts. Synchronous mounts do not buffer data, and
thus limit the damage done by unexpected disk removals. The downside
is that they are far slower than normal (i.e. asynchronous) mounts.

Fdutils can be found at the following locations:

linux.wauug.org:/pub/knaff/fdutils/fdutils-4.3.src.tar.gz
sunsite.unc.edu:/pub/Linux/system/Misc/fdutils-4.3.src.tar.gz
tsx-11.mit.edu:/pub/linux/sources/sbin/fdutils-4.3.src.tar.gz

Alain