lkml.org 
[lkml]   [2000]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Of removable devices
In <Pine.LNX.3.95.1000216152401.1546A-100000@chaos.analogic.com> Richard B. Johnson (root@chaos.analogic.com) wrote:
RJ> On Wed, 16 Feb 2000, Khimenko Victor wrote:
RJ> [SNIPPED...]
>>
>> No. You misunderstood conception again.

RJ> I understand 'conception' perfectly.

No :-) You are looking on problem from inside (from Linux filesystem side)
not from outside (from "naive user" viewpoint).

>> Idea is simple: user DO NOT NEED TO DO
>> ANYTHING before floppy removal. But when program tries to write on removed
>> floppy (even if there are other floppy inserted and even used) kernel will send
>> message to notification daemon with request to put old floppy back. Process is
>> stopped and all dirty buffers are kept in memory till floppy is changed back.
>> When "right" floppy is inserted dirty buffers will be put on said floppy and
>> process can continue. Without such protection ANY supermount implementations
>> are just invitations to disaster. And THAT will require lots of changes in VFS.
>>

RJ> DOS floppies have a serial number (32 bits). They can be identified.
RJ> This doesn't fix anything though.

It CAN fix things. Not easy though :-(

RJ> Under Unix, we `mount` disk devices to make them accessible. You can not
RJ> mount another floppy without unmounting the previous one so you never
RJ> have the supposed problem of; "having another inserted and even used",
RJ> unless you are just writing to it raw, which in that case nothing will
RJ> protect you because you can write to the raw device even if it's the
RJ> correct one and it's mounted.

"Naive user" wants the following:
1. insert floppy with letters
2. fire CoolOffice(tm) and open letter; CoolOffice will create lock file on
floppy and will NOT close this file (MS Word for Windows doing this).
... time passed ...
3. Oops. Now I need my reports from other floppy!
4. ... floppy with letters removed (remember: there exist opened file!)
and new floppy with reports inserted and opened in the same CoolOffice(tm)
... time passed ...
5. "Save" button in letter pressed...
6. Oops. Wrong floppy in driver. System asks to insert right on and letter
is saved on right floppy.

This is how Windows 9X working (when not crashing that is :-) and user EXPECT
this and ONLY this behaviour. Any other behaviour will need changes in users
mind. And we need retrain users then why not to train it to do mount/umount ???
So "this can not happen" is NOT an answer. It SHOULD happen or else there are
no point in supermount at all. Yes, this will require LOTS of changes. But it's
ONLY sane way do deal with floppies without kernel-driven lock, sorry.

RJ> However, there is a button on most of the PC drives that 'allows' a user
RJ> to remove a mounted floppy.

Exactly.

RJ> Sun machines don't have any such button, so you can't do something that
RJ> you are not supposed to do without using a paper-clip. If you use a
RJ> paper-clip, you get worse than you asked for because on the Sun, an
RJ> access to a nonexistent floppy will panic the machine.

RJ> Under Linux, it's just:

RJ> Script started on Wed Feb 16 15:34:04 2000
RJ> # mount /dev/fd0 /mnt
RJ> # ls /mnt
RJ> command.com drvspace.bin io.sys msdos.sys
RJ> # cp xxx.c /mnt
RJ> #
RJ> # cp xxx.c /mnt
RJ> cp: cannot create regular file `/mnt/xxx.c': Read-only file system
RJ> # umount /mnt
RJ> # exit
RJ> exit

RJ> Script done on Wed Feb 16 15:35:27 2000

RJ> Upon such an error, the file-system is just turned into read-only.
RJ> Of course, if kernel error messages are being fed to your terminal,
RJ> the stuff you get on the screen looks far more serious.

RJ> The program I wrote will flush file-system buffers to the floppy so
RJ> that even if you remove it, the floppy contents are correct.

And WHO will start said program ? Remember: we are talking about "naive" (or
dumb) user who was trained under Windows and DO NOT WANT TO LEARN! Said user
just DO NOT CARE about file-system buffers, mount/umount and other such stuff.
Basically he want to insert floppies and just open/edit documents from such
floppies. And system (NOT USER!) should work around all software/hardware
limitation.

RJ> Suppose you invented a new kind of Unix where you didn't have to
RJ> mount file-systems to make them accessible, and you didn't have
RJ> to unmount them to update their contents before making then inaccessible.

This is idea behind the whole discussion.

RJ> You are just going to read the device to see if anything is there.
RJ> How would you let the kernel 'know' that the right one was installed
RJ> in the first place? Certainly you would have to send the kernel a
RJ> command that this with the 'right one'. So, you have just "mounted"
RJ> the file-system. You just told the kernel that this is the one you
RJ> want to use.

Mount part is not hard. Umount is...

RJ> Now, suppose each file-system had a unique ID, like the floppy ID.
RJ> The kernel can then 'know' if the floppy has been removed by reading
RJ> the ID each time (when....). If you are going to re-read the physical
RJ> device every time you access the file-system, you now have a
RJ> paper-tape for speed.
No. Most floppies (even stupid old PC floppies; only old IBM PC/XT had floppy
without such ability) CAN say you if media was changed or not. And this check
is fast (in comparision to floppy speed, of course). So you SHOULD NOT check
if there is right floppy in drive unless floppy is actually changed.

RJ> Instead, the kernel treats the floppy just like the other VFS devices.

Exactly :-) And while kernel threats the floppy just like the other VFS
device there are not point in supermount.

RJ> It does most of its I/O to buffers in memory. The only time the buffers
RJ> are guaranteed to be written to the physical media is when it's
RJ> un-mounted.

RJ> Floppies are considered cheap throw-away items. You don't add non-trivial
RJ> exception handlers to the kernel to save 15 cents now and then.

Floppies are cheap. DATA FILES on said floppies are DEFINITELY NOT cheap.
When "super-realiable" (and this is true if we'll compare it with Windows)
linux with supermount will ruin data files 10 times more then "unreliable
and constantly crashing" (this is also true if we'll compare it with Linux)
Windows Linux will be thrown out in hurry. It does not matter if system does
not crash if work results are lost and work should be redone.

P.S. You can argue that most peoples will not notice since floppies are not
very popular today. Correct. And such users will not notice if there are
exist supermount or not :-)




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [from the cache]
©2003-2011 Jasper Spaans