From: YanHong Date: Fri, 2 Dec 2011 03:12:49 +0000 (+1100) Subject: init/do_mounts.c: create /root if it does not exist X-Git-Tag: next-20111202~2^2~83 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=cffe276ae82723fcae5b12fd01ef21aea43b89e9;p=karo-tx-linux.git init/do_mounts.c: create /root if it does not exist 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 Cc: Al Viro Cc: Woody Suwalski Signed-off-by: Andrew Morton --- diff --git a/init/do_mounts.c b/init/do_mounts.c index 0f6e1d985a3b..7ea68fb301e6 100644 --- 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) {