]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
init/do_mounts.c: create /root if it does not exist
authorYanHong <tempname2@hotmail.com>
Fri, 16 Dec 2011 04:50:23 +0000 (15:50 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 20 Dec 2011 07:43:53 +0000 (18:43 +1100)
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 a more detailed error message, or we can go further: if /root
does not exit, create it.

Signed-off-by: YanHong <tempname2@hotmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Woody Suwalski <terraluna977@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
init/do_mounts.c

index 0f6e1d985a3b2851c662337c1671b57cc4270f0a..7ea68fb301e6e9ec9619abcd6e65f7ad6fd3106e 100644 (file)
@@ -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) {