Re: [PATCH] init/do_mounts.c : Create /root if it does not exits

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

 



Andrew Morton wrote:
On Sat, 26 Nov 2011 08:34:18 +0000
yanhong<tempname2@xxxxxxxxxxx>  wrote:

From: YanHong<tempname2@xxxxxxxxxxx>

If someone supplies an initramfs without /root in it, and we fail to execute rdinit, we will try to mount root device and fail, for the mount point does not exits.

But we get error message "VFS: Cannot open root device". It's confusing.

We can give more detailed error message, or we can go further: if /root does not exits,  create one.

I really don't know enough about initramfs usage to know if this is a
good or bad thing.  Can anyone else comment?

--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -350,6 +350,9 @@ void __init mount_block_root(char *name, int flags)
         const char *b = name;
  #endif

+       if (sys_access((const char __user *) "/root", 0) != 0)
+               sys_mkdir((const char __user *) "/root", 0700);
+
         get_fs_names(fs_names);
  retry:
         for (p = fs_names; *p; p += strlen(p)+1) {
I suppose we could remove the sys_access() check and just run mkdir(),
which will fail to do anything if /root already exists.

I think that it may lead to more problems... If I make mistake in the initramfs or forget to make one I want to know about it, rather then see some unexpected root and system maybe partially booting. Unless we start printing a highly visible warning along? Still - it is cleaner to simply stop boot (IMHO).

Woody

--
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