Ejecting floppies at the wrong moment

Philip Blundell (pjb27@cam.ac.uk)
Sat, 16 Sep 1995 17:12:21 +0100 (BST)


I know the topic of how to deal with people popping discs out of the
drive has come up here before, but I don't remember if any good actually
ever came of the discussion.

At the moment, ejecting a floppy while it's mounted seems to have dire
consequences for the system; you get an kernel panic, and any subsequent
attempts to access the disc lock up in uninterrupible sleep. In the end
you have to hit the reset button.

If nothing else, it would be handy if this could be avoided. As an
interim solution, perhaps we could arrange for the VFS layer to spot that
the disc has been changed (as it does now), force the entire contents of
the buffer cache to be thrown away, dirty or not (with appropriate 'you
have just lost data' messages sent to the console) and unmount the disc.
Yes, this is a nasty thing to do. Yes, this will probably result in
people losing data. However, I don't think it will make things worse than
they are at the moment -- it ought to prevent the kernel mistakenly
flushing buffers onto the *wrong* disc, and it ought to avoid the current
problem of the system locking up.

I can't think of any particular reason why this couldn't be done, or why
it wouldn't be a good idea. What does everybody else think?

Phil