Overmounting a filesystem

H. Peter Anvin (hpa@freya.yggdrasil.com)
9 Apr 1996 06:30:43 GMT


Currently it seems Linux does not permit overmounting a filesystem
(mounting a filesystem on top of another, on the same path).

In fs/super.c:

int do_mount(kdev_t dev, const char * dev_name, const char * dir_name,
const char * type, int flags, void * data)
{
struct inode * dir_i;
struct super_block * sb;
struct vfsmount *vfsmnt;
int error;

if (!(flags & MS_RDONLY) && dev && is_read_only(dev))
return -EACCES;
/*flags |=3D MS_RDONLY;*/
error =3D namei(dir_name, &dir_i);
if (error)
return error;
if (dir_i->i_count !=3D 1 || dir_i->i_mount) {
^^^^^^^^^^^^^^
iput(dir_i);
return -EBUSY;
}

Is there a rationale for this restriction (I know SunOS 4 doesn't
have it.) There are a bunch of nifty tricks involving userfs which
would hinge on this being permitted.

-hpa
--=20
PGP public key available - finger hpa@zytor.com
"The earth is but one country, and mankind its citizens." -- Bah=E1'u=
'll=E1h
I don't work for Yggdrasil, but they sponsor the linux.* hierarchy.