mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Joshua Hudson" <joshudson@gmail.com>
To: "Kyle Moffett" <mrmacman_g4@mac.com>, linux-kernel@vger.kernel.org
Subject: Re: Which process context does /sbin/hotplug run in?
Date: Sun, 14 May 2006 21:28:49 -0700	[thread overview]
Message-ID: <bda6d13a0605142128p4ef3423cr1cbe9dd364e45086@mail.gmail.com> (raw)
In-Reply-To: <6BCF90AC-FF8B-48BC-8659-DBE0DD00E270@mac.com>

>
> > 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.

  reply	other threads:[~2006-05-15  4:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-12 18:20 Rob Landley
2006-05-13  7:24 ` Kyle Moffett
2006-05-15  0:08   ` Rob Landley
2006-05-15  4:17     ` Kyle Moffett
2006-05-15  4:28       ` Joshua Hudson [this message]
2006-05-15 19:59       ` Rob Landley
2006-05-15 22:22         ` Kyle Moffett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bda6d13a0605142128p4ef3423cr1cbe9dd364e45086@mail.gmail.com \
    --to=joshudson@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mrmacman_g4@mac.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®