Re: floppy regression from "[PATCH] fix floppy.c to store correct ..."

Bodo Eggert
2005-11-23T17:37:48Z

Jon Masters <jonmasters@gmail.com> wrote:
> On 11/22/05, Andrew Morton <akpm@osdl.org> wrote:

>> In the meanwhile I think we should revert back to the 2.6.14 version of
>> floppy.c - the present problem is probably worse than the one which it
>> kinda-fixes.
>
> Ok, as you please. It's probably going to take something much more
> ugly to make this work with things as they stand - I'll get something
> out at the weekend.

I think it should be a general solution to flipped CP switches on floppies
and USB sticks as well as network block devices on a fs that got remounted
ro or hdparm -W.

The device needs a WP status that gets updated on open or mount (must
complete before open()/mount() completes), on failed write()s iff the write
failed because of write protection error and whenever checking is cheap.
If the check can't be done sanely on open() calls (as in the case of NBD),
asume it to be RW enabled unless we know otherwise (e.g. the user told us).
(re)mounts should allways enforce the check as long as it's possible.
The filesystems will need to get updated to use this status as well and
remount themselves ro (or do a panic/reboot, if desired).

This will still misbehave, but I think it will misbehave in a sane way. You
may get a rw mount on ro devices in corner cases, but you can't keep it. If
you erroneously got your device ro, you can update the status by remounting,
so you won't get stuck with a busy ro filesystem. "true>/dev/node" will
update the state, too, but I doubt it's usefullness unless the application
using the device is designed to take use of this feature.

--
Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF
verbreiteten Lügen zu sabotieren.