mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Vishnu Pratap Singh <vishnu.ps@samsung.com>
Cc: paul.gortmaker@windriver.com, snitzer@redhat.com,
	dehrenberg@chromium.org, pavel@ucw.cz, mszeredi@suse.cz,
	linux-kernel@vger.kernel.org, cpgs@samsung.com
Subject: Re: [PATCHv2] init/do_mounts: Add create_dev() failure log
Date: Wed, 27 May 2015 16:27:49 -0700	[thread overview]
Message-ID: <20150527162749.60e3f39da22753b1c011f4a1@linux-foundation.org> (raw)
In-Reply-To: <1432621618-9567-1-git-send-email-vishnu.ps@samsung.com>

On Tue, 26 May 2015 11:56:58 +0530 Vishnu Pratap Singh <vishnu.ps@samsung.com> wrote:

> if create_dev() function fails to create the root mount device (/dev/root),
> then it goes to panic as root device not found but there is no check/log
> present in case of failure, So i have added the log in case it fails to
> create the root device. It will help in debugging.
> 
> ...
>
> --- a/init/do_mounts.c
> +++ b/init/do_mounts.c
> @@ -532,7 +532,8 @@ void __init mount_root(void)
>  	}
>  #endif
>  #ifdef CONFIG_BLOCK
> -	create_dev("/dev/root", ROOT_DEV);
> +	if (create_dev("/dev/root", ROOT_DEV) < 0)
> +		pr_err("Failed to create %s device !\n", "/dev/root");

That's a pretty strange use of printk.

And KERN_EMERG seems more appropriate when this happens.

And we may as well let the poor user know why the mknod failed.

This?

--- a/init/do_mounts.c~init-do_mounts-add-create_dev-failure-log-fix
+++ a/init/do_mounts.c
@@ -533,9 +533,13 @@ void __init mount_root(void)
 	}
 #endif
 #ifdef CONFIG_BLOCK
-	if (create_dev("/dev/root", ROOT_DEV) < 0)
-		pr_err("Failed to create %s device !\n", "/dev/root");
-	mount_block_root("/dev/root", root_mountflags);
+	{
+		int err = create_dev("/dev/root", ROOT_DEV);
+
+		if (err < 0)
+			pr_emerg("Failed to create /dev/root: %d\n", err);
+		mount_block_root("/dev/root", root_mountflags);
+	}
 #endif
 }
 
_


      parent reply	other threads:[~2015-05-27 23:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <130285@samsung.com>
2015-05-25  5:17 ` [PATCH] " Vishnu Pratap Singh
2015-05-25 12:59   ` Pavel Machek
2015-05-25 13:49   ` Vishnu Pratap Singh
2015-05-26  6:25     ` Pavel Machek
2015-05-26  6:26   ` [PATCHv2] " Vishnu Pratap Singh
2015-05-26  8:32     ` Pavel Machek
2015-05-27 23:27     ` Andrew Morton [this message]

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=20150527162749.60e3f39da22753b1c011f4a1@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=cpgs@samsung.com \
    --cc=dehrenberg@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@suse.cz \
    --cc=paul.gortmaker@windriver.com \
    --cc=pavel@ucw.cz \
    --cc=snitzer@redhat.com \
    --cc=vishnu.ps@samsung.com \
    /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

all inboxes | Powered by JetHome®