From: Daniel Drake <dsd@laptop.org>
To: linux-fsdevel@vger.kernel.org
Subject: Remount root RO after the root dentry drops from the namespace
Date: Wed, 18 Nov 2009 11:12:01 +0000 [thread overview]
Message-ID: <1258542722.2761.40.camel@localhost.localdomain> (raw)
Hi,
OLPC ships a slightly strange filesystem layout. We keep everything
under /versions/run/<hash>. For example, libc is
at /versions/run/<hash>/lib/libc.so.6
The background behind this is that we can then create a mass of
hardlinks to that original OS, and do a safe OS update by downloading
files that have changed into that 2nd tree, breaking the hardlinks as we
go. At the end we can atomically update the symlink that points to
the /versions/run/<hash> which determines which OS is booted into on
reboot. Therefore we have atomic OS updates which can be interrupted
without consequences.
Once the system is booted, this weird layout is barely visible, because
the initramfs performs a series of chroot and mount --move steps in
order to make things function as normal. Assuming that the initramfs
mounts the root partition at /sysroot in its namespace and the hash
we're booting into is just "1", then this is what happens:
1. cd /sysroot
2. mount --move . /
3. chroot .
4. cd /
5. chdir /versions/run/1
6. chroot .
7. cd /
8. exec /sbin/init
This works well and the system functions as normal. However, I've
noticed that during shutdown, the root filesystem is never unmounted
cleanly.
"mount -o remount,ro /" always fails due to this check in do_remount():
if (path->dentry != path->mnt->mnt_root) {
return -EINVAL;
Obviously the dentry for the / path that we are trying to unmount is not
the actual root of the mount. However the root of the mount is long
gone, so I'm not sure what we can do. And shutting down cleanly is
obviously important!
Any thoughts?
Thanks!
Daniel
next reply other threads:[~2009-11-18 11:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-18 11:12 Daniel Drake [this message]
2009-11-18 11:50 ` Remount root RO after the root dentry drops from the namespace Miklos Szeredi
2009-11-18 12:38 ` Daniel Drake
2009-11-18 12:58 ` Miklos Szeredi
2009-11-18 14:52 ` Karel Zak
2009-11-18 15:28 ` Miklos Szeredi
2009-11-18 17:08 ` Karel Zak
2009-11-18 17:38 ` Miklos Szeredi
2009-11-18 15:18 ` Daniel Drake
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=1258542722.2761.40.camel@localhost.localdomain \
--to=dsd@laptop.org \
--cc=linux-fsdevel@vger.kernel.org \
/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).