lkml.org 
[lkml]   [2015]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCHv2] init/do_mounts: Add create_dev() failure log
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
}

_


\
 
 \ /
  Last update: 2015-05-28 02:01    [W:1.928 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site