Re: Remount root RO after the root dentry drops from the namespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 18 Nov 2009, Daniel Drake wrote:
> 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!

You can easily make a directory a root of a mount with

 mount --bind $DIR $DIR

In your example, add this before 5.

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux