Re: Overmounting a filesystem

Albert Cahalan (albert@ccs.neu.edu)
Fri, 12 Apr 1996 10:33:39 -0400 (EDT)


>> mount /dev/hda2 /home
>> ... do things
>> mount /dev/hda3 /home
>
> can I do things like that:
>
> mount /dev/cdrom /cdrom
> mount /cdrom/adirectory /home/ftp/adirectory

With Linux, I am almost sure you can not do that.

With OSF/1 and Digital Unix, I think you can. You can mount
one file on top of another, so directories might work too.
I think it gets very complicated unless you are happy with
symlink behavior or a missing /cdrom/adirectory.

The complication is that you need a different view of the filesystem
for each process. Something in /home/ftp/adirectory is also in
/cdrom/adirectory, so what does .. refer to? If it refers to /cdrom,
then the mount behaves like a symlink (but more useful, because the
underlying directory need not be removed). If it refers to /cdrom
or /home/ftp depending on how the process got there, you have to
track different views of the filesystem for different processes.

BTW, this and the union fs do not belong in user space!
I think there is a huge security hole. Some process could
just ignore the library and make syscalls directly.