From: Rob Landley <landley@trommello.org>
To: Alexander Viro <viro@math.psu.edu>,
Jamie Lokier <lk@tantalophile.demon.co.uk>
Cc: Daniel Phillips <phillips@arcor.de>,
Rusty Russell <rusty@rustcorp.com.au>,
linux-kernel@vger.kernel.org
Subject: Moving a mount point (was Re: Question about pseudo filesystems)
Date: Sat, 14 Sep 2002 21:41:45 -0400 [thread overview]
Message-ID: <200209152012.g8FKC0Ic208648@pimout2-ext.prodigy.net> (raw)
In-Reply-To: <Pine.GSO.4.21.0209072232500.23664-100000@weyl.math.psu.edu>
On Saturday 07 September 2002 10:43 pm, Alexander Viro wrote:
> IOW, filesystem shutdown is _always_ a garbage collection - there's nothing
> special about vfsmounts that are not mounted somewhere. Check for fs
> being busy in umount(2) is just a compatibility code - kernel is perfectly
> happy with dissolving mountpoints, busy or not. If stuff mounted is not
> busy it will be shut down immediately, if not - when it stops being busy.
This wanders into something I've been trying to figure out for a while now.
I want to move an existing mount point. I can't unmount it, because it's got
a file open in it, but I want to move it to another binding in the tree and
make the original binding go away so the filesystem IT'S under can go away.
I can create a duplicate binding, but can't get the first binding to go away
while the filesystem's in use.
In case you're curious, the reason is I created a system where the whole root
partition is a zisofs image, with /boot, /etc, /root, and /tmp symlinks to
directories under /var. When the system is fully up, /var will be a mount
point for /dev/hda1 (ext3), and /home on /dev/hda3. / is loopback mounted
from a file ("firmware") under /var.
To make this work, I make an initrd, which mounts /dev/hda1 on /var, does an
losetup on /dev/loop0, exits and lets the boot continue (with root on
/dev/loop0), and then runs /sbin/init-first which does a mount --bind
/initrd/var to /var (duplicating the mount point), and then "exec
/sbin/init", and life goes on. (Obviously, init-first has to run before init
or else /etc is a symlink pointing to nothing. Haven't cleaned up /etc
enough that it can be read-only, not sure I ever will...)
The downside of duplicating the binding in init-first rather than moving it
is I can't unmount /initrd and free its memory. It's not a major burning
issue keeping me awake at night (caffiene manages to do that quite well on
its own, thank you), it's just two extra mount entries in /proc/mounts and
about four megabytes of wasted ram on a system with a quarter gig of the
stuff, but it seems there should be a way to do this...
Since each filesystem only has one superblock (regardless of the number of
mount points), there's no way it can care too deeply about where it's
mounted. The losetup really shouldn't care too much either (fundamentally,
it's bound to an inode). So there's no theoretical reason "mount --move /old
/new" couldn't be made to work. There may need to be a loop to flush
dentries, and some locking, but that would be about it. (Mount points under
the mount point being moved could either be moved as well, or the action
could be denied if any exist. The first is cleaner, it's sort of the
opposite of chroot or pivot_root. P.S. yes, I tried a few variants of
pivot_root, that fails if either of the filesystems has any files open in
it...)
It could just be that since the concept of mount point and filesystem
instance were only separated in 2.4, that this is just a historical relic.
If so, I'd like to correct it. A filesystem instance can't go away with an
open file, but a mount point can...
Did I miss the ability to do this already, or are the userspace tools simply
not taking advantage of something the kernel can currently do, or I need to
come up with a patch to make this work under the 2.4 kernel? (I've poked
around a bit, and vfs.txt does a pretty good job of describing how things
were in 2.1.99, back when mount points and filesystem instances were the same
thing...)
Rob
next prev parent reply other threads:[~2002-09-15 20:07 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-04 18:02 Question about pseudo filesystems Jamie Lokier
2002-09-07 12:00 ` Daniel Phillips
2002-09-07 13:36 ` Alexander Viro
2002-09-07 18:27 ` Jamie Lokier
2002-09-07 19:47 ` Alexander Viro
2002-09-08 2:21 ` Jamie Lokier
2002-09-08 2:43 ` Alexander Viro
2002-09-15 1:41 ` Rob Landley [this message]
2002-09-08 16:00 ` Daniel Phillips
2002-09-09 19:48 ` Jamie Lokier
2002-09-09 20:06 ` Daniel Phillips
2002-09-10 0:44 ` Jamie Lokier
2002-09-10 1:40 ` Daniel Phillips
2002-09-10 1:56 ` Jamie Lokier
2002-09-10 2:53 ` Daniel Phillips
2002-09-10 3:26 ` Jamie Lokier
2002-09-10 3:47 ` Daniel Phillips
2002-09-10 9:15 ` Daniel Phillips
2002-09-10 10:17 ` Roman Zippel
2002-09-11 18:35 ` [RFC] Raceless module interface Daniel Phillips
2002-09-11 18:53 ` Oliver Neukum
2002-09-11 19:20 ` Daniel Phillips
2002-09-11 20:29 ` Oliver Neukum
2002-09-11 21:15 ` Daniel Phillips
2002-09-11 21:26 ` Jamie Lokier
2002-09-11 21:47 ` Daniel Phillips
2002-09-12 1:42 ` Rusty Russell
2002-09-12 2:09 ` Jamie Lokier
2002-09-12 3:13 ` Rusty Russell
2002-09-12 3:47 ` Daniel Phillips
2002-09-12 3:53 ` Alexander Viro
2002-09-12 4:11 ` Daniel Phillips
2002-09-12 4:40 ` Rusty Russell
2002-09-12 5:27 ` Daniel Phillips
2002-09-12 14:46 ` Gerhard Mack
2002-09-13 0:39 ` Rusty Russell
2002-09-13 2:23 ` Daniel Phillips
2002-09-12 5:35 ` Rusty Russell
2002-09-12 4:52 ` Rusty Russell
2002-09-12 5:58 ` Daniel Phillips
2002-09-12 7:00 ` Rusty Russell
2002-09-13 8:18 ` Helge Hafting
2002-09-12 3:32 ` Daniel Phillips
2002-09-12 1:31 ` Rusty Russell
2002-09-12 9:10 ` Oliver Neukum
2002-09-12 11:27 ` Roman Zippel
2002-09-12 13:03 ` Rusty Russell
2002-09-12 13:44 ` Roman Zippel
2002-09-13 1:30 ` Rusty Russell
2002-09-13 2:19 ` Daniel Phillips
2002-09-13 6:51 ` Rusty Russell
2002-09-13 13:34 ` Daniel Phillips
2002-09-13 13:52 ` Thunder from the hill
2002-09-13 14:09 ` Daniel Phillips
2002-09-13 14:33 ` Thunder from the hill
2002-09-13 14:44 ` Daniel Phillips
2002-09-13 14:59 ` Thunder from the hill
2002-09-13 15:17 ` Daniel Phillips
2002-09-13 15:27 ` Thunder from the hill
2002-09-13 15:37 ` Daniel Phillips
2002-09-16 2:17 ` Rusty Russell
2002-09-16 16:13 ` Daniel Phillips
2002-09-16 16:36 ` Understanding the Principles of Argumentation #3 Daniel Phillips
2002-09-16 16:42 ` Robinson Maureira Castillo
2002-09-16 17:29 ` Cort Dougan
2002-09-16 22:31 ` David Woodhouse
2002-10-01 14:13 ` Daniel Phillips
2002-10-01 14:27 ` David Woodhouse
2002-09-13 15:59 ` [RFC] Raceless module interface Daniel Phillips
2002-09-13 3:14 ` David Gibson
2002-09-13 10:35 ` Roman Zippel
2002-09-13 13:53 ` Daniel Phillips
2002-09-13 15:13 ` Roman Zippel
2002-09-13 15:30 ` Daniel Phillips
2002-09-13 15:55 ` Roman Zippel
2002-09-13 16:09 ` Daniel Phillips
2002-09-13 16:39 ` Thunder from the hill
2002-09-13 17:12 ` Daniel Phillips
2002-09-16 0:24 ` Bill Davidsen
2002-09-16 1:49 ` Rusty Russell
2002-09-16 21:36 ` Roman Zippel
2002-09-16 21:48 ` Daniel Phillips
2002-09-16 22:44 ` Roman Zippel
2002-09-11 15:28 ` Question about pseudo filesystems Bill Davidsen
2002-09-11 19:36 ` Daniel Phillips
2002-09-09 20:12 ` Daniel Phillips
2002-09-09 22:56 ` Jamie Lokier
2002-09-10 1:39 ` Alexander Viro
2002-09-09 20:18 ` Daniel Phillips
2002-09-10 6:48 ` Kai Henningsen
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=200209152012.g8FKC0Ic208648@pimout2-ext.prodigy.net \
--to=landley@trommello.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lk@tantalophile.demon.co.uk \
--cc=phillips@arcor.de \
--cc=rusty@rustcorp.com.au \
--cc=viro@math.psu.edu \
/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;
as well as URLs for NNTP newsgroup(s).