From da618ca3547828215f56d075e9985902f7e8f2a2 Mon Sep 17 00:00:00 2001 From: YanHong Date: Fri, 2 Dec 2011 14:12:49 +1100 Subject: [PATCH] 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 --- init/do_mounts.c | 3 +++ 1 file changed, 3 insertions(+) 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) { -- 2.39.5