linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: yanhong <tempname2@hotmail.com>
Cc: <linux-kernel@vger.kernel.org>,
	linux-fsdevel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] init/do_mounts.c : Create /root if it does not exits
Date: Wed, 30 Nov 2011 12:55:55 -0800	[thread overview]
Message-ID: <20111130125555.85ac54e7.akpm@linux-foundation.org> (raw)
In-Reply-To: <COL118-W62A0038F6E85B96D4881F6F6CC0@phx.gbl>

On Sat, 26 Nov 2011 08:34:18 +0000
yanhong <tempname2@hotmail.com> wrote:

> 
> From: YanHong <tempname2@hotmail.com>
> 
> 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.

       reply	other threads:[~2011-11-30 20:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <COL118-W62A0038F6E85B96D4881F6F6CC0@phx.gbl>
2011-11-30 20:55 ` Andrew Morton [this message]
2011-12-01  0:24   ` [PATCH] init/do_mounts.c : Create /root if it does not exits Woody Suwalski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111130125555.85ac54e7.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tempname2@hotmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).