Re: Floppy handling

From: Manfred Spraul (manfred@colorfullife.com)
Date: Thu Jun 22 2000 - 11:39:05 EST


Richard Stallman wrote:
>
> Hmm, isn't a fs mounted with "-o sync" plus an automounter (autofs, for
> example) unmounting a floppy after a short (such as a few seconds) timeout
> sufficient? This way you have both the floppy cached and coherent.
>
> This might work. Can it unmount the floppy even if you have cd'd to
> it?
>

We definitively can't unmount a floppy with an open file handle. And if
we unmount on eject, then an accidential eject will corrupt data.

I think we should emulate Windows: (afaik DOS uses the same
implementation)

The main idea is that multiple disks can be mounted on one physical
device at the same time. One mount is the "current" disk, the other
mounts are older, not yet expired disks (typically with open handles, or
during media changes)

* An automounter mounts and unmounts every few seconds [on floppies: 2
seconds without accesses]. "Unmount" means that /mnt/floppy is
invalidated, the superblock and all old file handles remain valid.
* A volume tracker is inserted between the filesystem and the actual
block device driver.
* The filesystem doesn't read directly from the block device, it reads
from the volume tracker. If the wrong disk is inserted, then the volume
tracker delays the IO. It pops up a UI (if a UI daemon is available), or
it fails the io operation.
* When the last open handle for a fs is closed, a garbage collector
unmounts the filesystem.
* The mount code of each filesystem scans the list of all older mounts
(but not yet unmounted), and returns a special -EREMOUNT code with the
pointer to the old superblock.

It should be possible to implement everything in user space:
* O_SYNC mounts
* an array of nbd like block devices for each physical drive.
* user space volume tracker.
* /auto/floppy is a symlink to the current /auto/disk<n> fs. That
symlink expires very often (after a few seconds), and we can expire it
even with open file handles, or when we have cd'd to it,...
* /auto/disk<n> mounts one of the nbd devices, they loop into user
space, and user space verifies that the correct disk is inserted before
writing. It can show a warning ("Please enter the disk with the serial
number 01234:5678 or your can loose your data"), and retry.

I know that it sounds very complicated, but we should give the user a
second chance if he has accidentially removed a disk.

--
	Manfred

- 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/



This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:24 EST