Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Apr 2002 20:02:36 -0400
From:      utsl@quic.net
To:        "Andrew P. Lentvorski" <bsder@allcaps.org>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: Non-standard root filesystems
Message-ID:  <20020501000236.GB28212@quic.net>
In-Reply-To: <20020430141744.P312-100000@mail.allcaps.org>
References:  <20020430204153.GB3603@quic.net> <20020430141744.P312-100000@mail.allcaps.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 30, 2002 at 03:58:09PM -0700, Andrew P. Lentvorski wrote:
> utsl@quic.net wrote:
> > Linux has a syscall (pivot_root) to swap the root with another mounted
> > filesystem. It is occasionally quite useful, and I've been wondering
> > about implementing it (or something similar) on FreeBSD.
> >
> > Possibly you can tell me why that wouldn't work, or would be a bad
> > idea.
> That sounds like a fine idea.  What are the issues with doing that?

I've been taking a look, and I think it is probably beyond my skill. :(
From what I can see the following would be necessary:

	1. locate mount structs for both old and new root filesystems
	2. lock mount structures
	3. swap pointers in mount list? (not sure if this is necessary)
	4. set MNT_ROOTFS on new root filesystem, clear on old
	5. unlock mount structures (I think it'd be safe at that point)
	6. the ugly part: walk through all processes and file
	   descriptors, and switch the root directory. Also switch cwd if
	   it is /.

I'm probably missing something.

	---Nathan


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-fs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020501000236.GB28212>