From owner-freebsd-fs Tue Apr 30 17: 2:41 2002 Delivered-To: freebsd-fs@freebsd.org Received: from quic.net (romulus.quic.net [216.23.27.8]) by hub.freebsd.org (Postfix) with SMTP id 5D85237B400 for ; Tue, 30 Apr 2002 17:02:29 -0700 (PDT) Received: (qmail 415 invoked by uid 1032); 1 May 2002 00:02:36 -0000 From: utsl@quic.net Date: Tue, 30 Apr 2002 20:02:36 -0400 To: "Andrew P. Lentvorski" Cc: freebsd-fs@freebsd.org Subject: Re: Non-standard root filesystems Message-ID: <20020501000236.GB28212@quic.net> References: <20020430204153.GB3603@quic.net> <20020430141744.P312-100000@mail.allcaps.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020430141744.P312-100000@mail.allcaps.org> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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