Re: pivot_root broken in 2.6.15-rc1-mm2
From: Neil Brown
Date: Thu Nov 24 2005 - 00:09:28 EST
On Wednesday November 23, rob@xxxxxxxxxxx wrote:
> On Tuesday 22 November 2005 20:07, Neil Brown wrote:
> > Pivot_root seems to be broken in 2.6.15-rc1-mm2.
> >
> > I havea initramfs filesystem, mount a ext3 filesystem (which has /mnt)
> > at '/root' and
> >
> > cd /root
> > pivot . mnt
> >
> > and it says -EINVAL.
>
> You can't pivot_root initramfs because initramfs is rootfs.
>
> I wrote Documentation/filesystems/ramfs-rootfs-initramfs.txt just for this
> occasion. :)
Unfortunately, 'man pivot_root' nor 'use the source, Luke' contain
pointers to this particular useful document. They both list assorted
restrictions on pivot_root, but not this one.
How about the following?
Thanks,
NeilBrown
Signed-off-by: Neil Brown <neilb@xxxxxxx>
### Diffstat output
./fs/namespace.c | 4 ++++
1 file changed, 4 insertions(+)
diff ./fs/namespace.c~current~ ./fs/namespace.c
--- ./fs/namespace.c~current~ 2005-11-23 14:24:59.000000000 +1100
+++ ./fs/namespace.c 2005-11-24 16:07:01.000000000 +1100
@@ -1526,6 +1526,10 @@ static void chroot_fs_refs(struct nameid
* pointed to by put_old must yield the same directory as new_root. No other
* file system may be mounted on put_old. After all, new_root is a mountpoint.
*
+ * Also, the current root cannot be on the 'rootfs' (initial ramfs) filesystem.
+ * See Documentation/filesystems/ramfs-rootfs-initramfs.txt for alternatives
+ * in this situation.
+ *
* Notes:
* - we don't move root/cwd if they are not at the root (reason: if something
* cared enough to change them, it's probably wrong to force them elsewhere)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/