difficult unmount-on-shutdown problem

Michael Stone michael at laptop.org
Fri Nov 6 11:13:09 EST 2009

Dan wrote:

> In #9629 I found a bug that also affects our deployed XO-1 OSes. We are
> always shutting down without unmounting the root filesystem.
> Any ideas?

Here's a crazy idea for you:

In the startup sequence you mentioned, perform a lazy unmount like so:

> mount disk at /sysroot
> chdir(/sysroot)
> mount --move /sysroot /
> chroot(.)
> chdir(/)

umount("/", MNT_DETACH)  <--- hereish, I think... but please play around.

> chdir(/versions/run/<hash>)
> chroot(.)
> chdir(/)
> exec(/sbin/init)

It seems plausible to me that this will result in / being unmounted when init
and all its children are finished. (Whether the lazy unmount will cause any
regressions remains to be seen; I don't understand its *exact* semantics well
enough to predict in advance.)

Other than this, I think you're going to need at least one of kernel patches, a
long-lived child of /init forked before the second chroot(), or a new design
for the startup sequence.



More information about the Devel mailing list