Floppy driver concerns

Paul Gortmaker (gpg109@rsphy1.anu.edu.au)
Sun, 9 Jun 1996 19:59:53 +1000 (EST)


Hi Alain,

Here is what may be considered a minor bug in the floppy driver:

1) Mount a floppy disk (ext2 in r/w mode)
2) sync and then pop it out once the light goes out.
3) Pop in another random (DOS even) floppy that you have laying around.
4) Now unmount the floppy.

In step 4 above, the driver happily writes the "I have been unmounted
cleanly" ext2 message to the foreign floppy, potentially scribbling
over whatever happened to be there before, and the driver doesn't even
moan one bit. Ugh. I am no floppy guru, but shouldn't the DCL be
checked before writing blindly to a removable media device, just to make
sure the user hasn't swapped in a new disk without thinking?

If you change the above situation to one that uses reads, things are
done in a sane fashion via DCL, and the driver moans loudly with a:

floppy0: disk absent or changed during operation

and then returns an IO error, which seems sensible enough.
My other minor query is why doesn't the floppy driver support:

fd = open("/dev/fd0", O_RDONLY);
ioctl(fd, BLKFLSBUF, NULL);

The other common block devices (such as SCSI disk, IDE disk and even RAM
disk) support BLKFLSBUF via invalidate_buffers().

BTW, you aren't presently listed in the MAINTAINERS file although you
are listed in the CREDITS file as the floppy driver hacker.

Regards,
Paul.