I've found a problem with pivot_root that worked fine in 2.6.13.3, butMiklos Szeredi put these lines there with the following comment:
fails for me, starting in 2.6.14-rc3 (haven't tried rc1 or rc2).
This is for LTSP.org (Linux Terminal Server Project) thin clients.
In our initramfs, we have a '/init' script that creates a mountpoint for
a 2nd ramfs, and i'm trying to pivot_root to that mount point.
I'm getting:
pivot_root: Invalid Argument
This worked perfectly in 2.6.13.3, so I looked at the 2.6.14-rc3 patch,
and I found the code in fs/namespace.c that is causing it to fail for
me:
@@ -1334,8 +1332,12 @@ asmlinkage long sys_pivot_root(const cha
error = -EINVAL;
if (user_nd.mnt->mnt_root != user_nd.dentry)
goto out2; /* not a mountpoint */
+ if (user_nd.mnt->mnt_parent == user_nd.mnt)
+ goto out2; /* not attached */
if (new_nd.mnt->mnt_root != new_nd.dentry)
goto out2; /* not a mountpoint */
+ if (new_nd.mnt->mnt_parent == new_nd.mnt)
+ goto out2; /* not attached */
tmp = old_nd.mnt; /* make sure we can reach put_old from
new_root */
spin_lock(&vfsmount_lock);
if (tmp != new_nd.mnt) {
The first of the 2 new tests are causing the pivot_root to fail for me.
If I comment out those lines, it works again.
I'm thinking that somebody put those lines there for a reason, so
there's possibly something wrong with the way i've been doing this for a
long time, and the tightening of the code has uncovered my problem.
I'll explain how we use the initramfs/nfsroot:googeling a little bit I found the following link:
[...]
Somebody recently told me that pivot_root has been put in the 'evil way
to do things' category, and that there was a new way, but he couldn't
remember what that was.