lkml.org 
[lkml]   [2006]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Which process context does /sbin/hotplug run in?
>
> > And I'm not _complaining_ about it. Just fiddling around with fun
> > stuff. If I get really bored I'll figure a way to split the tree
> > so there are two completely unconnected mount trees in different
> > processes. (Get a private namespace that's chrooted into
> > something that somebody else does a umount -l on from their space.
> > Or without using umount -l, just have two processes chroot into
> > other mount points which should theoretically garbage collect the
> > old root if no processes still references it, which presumably
> > means one of the processes is init...)
>
> Well, actually, it isn't that hard. Just run something like this:
>
> #! /bin/sh
> mkdir /a
> mkdir /b
> mount -t tmpfs tmpfs /a
> mount -t tmpfs tmpfs /b
> mkdir /a/old
> mkdir /b/old
> tool_to_fork_in_new_namespace sh -c "pivot_root /a /a/old && umount -
> l /a/old && read"
> pivot_root /b /b/old && umount -l /b/old && read
>
> All you need to write is tool_to_fork_in_new_namespace which does
> clone(CLONE_NEWNS) followed by exec().
>
> Cheers,
> Kyle Moffett
>
I've done that "two disconnected trees" in 2.0 kernel. Boot with an initrd.
/linuxrc runs something in the background (telnet server, just for kicks)
/initrd doesn't exist ont the new root.
So, try mount new root succeeds, but try unmount old root fails.
Presto. Two disconnected trees.

I wonder if it still works.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-05-15 06:31    [W:0.044 / U:1.932 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site