Re: [PATCH] private mounts

From: Miklos Szeredi
Date: Thu Apr 28 2005 - 02:12:20 EST

> ok. Generally overmounts are done on the root dentry of the topmost
> vfsmount. But in this case, your patch mounts it on the same dentry
> as that of the private mount.
> Essentially I was always under the assertion that 'a dentry can hold
> only one vfsmount'. But invisible mount seem to invalidate that
> assertion.

You can do that without an invisible mount:

mkdir /tmp/mnt
mkdir /tmp/dir1
mkdir /tmp/dir1/subdir1
mkdir /tmp/dir2
mkdir /tmp/dir2/subdir2

cd /tmp/mnt
mount --bind /tmp/dir1 .
mount --bind /tmp/dir2 .

Now you have both /tmp/dir1 and /tmp/dir2 rooted at the same dentry.

To test this, in another shell do this just after the first bind mount:

cd /tmp/mnt

Then after the second mount do

ls -l subdir1/..

Now unmount everything and repeat the experiment, but do the mounts
this way:

mount --bind /tmp/dir1 /tmp/mnt
mount --bind /tmp/dir2 /tmp/mnt

Now the second mount is an overmount of the first, and you will
actually get different result from the "ls".

Playing with mounts is fun :)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at