Why does the Linux kernel support "umount /"?
1
vote
1
answer
820
views
Why does Linux support this:
umount /
Why would anyone write that, instead of this:
mount / -oremount,ro
I'm looking at the kernel code here:
if (&mnt->mnt == current->fs->root.mnt && !(flags & MNT_DETACH)) {
/*
* Special case for "unmounting" root ...
* we just try to remount it readonly.
*/
if (!ns_capable(sb->s_user_ns, CAP_SYS_ADMIN))
return -EPERM;
down_write(&sb->s_umount);
if (!sb_rdonly(sb))
retval = do_remount_sb(sb, SB_RDONLY, NULL, 0);
https://elixir.bootlin.com/linux/v4.18/source/fs/namespace.c#L1612
Asked by sourcejedi
(53232 rep)
Sep 3, 2018, 09:51 AM
Last activity: Jul 20, 2023, 03:09 PM
Last activity: Jul 20, 2023, 03:09 PM