init/do_mounts: Add create_dev() failure log
PATCH 1/1 init/do_mounts: Add create_dev() failure log
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.
--- init/do_mounts.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
init/do_mounts.h +5 -1
@@ -15,8 +15,12 @@ extern int root_mountflags;static inline int create_dev (char *name,dev_t dev) { +int ret;sys_unlink (name); -return sys_mknod (name,S_IFBLK |0600 ,new_encode_dev (dev)); + ret =sys_mknod (name,S_IFBLK |0600 ,new_encode_dev (dev)); +if (ret <0 ) +printk (KERN_ERR " Failed to create %s device !! err: %d\n" , name, ret); +return ret; }#if BITS_PER_LONG ==32
Signature · 1 line
1.7.9.5
Quoted 15 lines · Vishnu Pratap Singh
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.Signed-off-by Vishnu Pratap Singh <[email protected]>--- init/do_mounts.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)init/do_mounts.h +0
-0
init/do_mounts.h extern int root_mountflags; · line 21
Quoted 8 lines
init/do_mounts.h +3
-1@@ -15,8 +15,12 @@ extern int root_mountflags;static inline int create_dev (char *name,dev_t dev) { +int ret;sys_unlink (name); -return sys_mknod (name,S_IFBLK |0600 ,new_encode_dev (dev)); + ret =sys_mknod (name,S_IFBLK |0600 ,new_encode_dev (dev)); +if (ret <0 )
if (ret < 0)
init/do_mounts.h extern int root_mountflags; · line 22
Quoted 1 line
init/do_mounts.h +1
-0+printk (KERN_ERR " Failed to create %s device !! err: %d\n" , name, ret);
Don't need space before 'Failed'.
Quoted 5 lines
init/do_mounts.h +1
-0+return ret; }#if BITS_PER_LONG ==32
Signature · 1 line
~Randy
Quoted 27 lines · On Fri, 22 May 2015 09:48:24 -0700 Randy Dunlap <[email protected]> wrote:
Quoted 15 lines · Vishnu Pratap Singh
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.Signed-off-by Vishnu Pratap Singh <[email protected]>--- init/do_mounts.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)init/do_mounts.h +0
-0init/do_mounts.h extern int root_mountflags; · line 21
Quoted 8 lines
init/do_mounts.h +3
-1@@ -15,8 +15,12 @@ extern int root_mountflags;static inline int create_dev (char *name,dev_t dev) { +int ret;sys_unlink (name); -return sys_mknod (name,S_IFBLK |0600 ,new_encode_dev (dev)); + ret =sys_mknod (name,S_IFBLK |0600 ,new_encode_dev (dev)); +if (ret <0 )if (ret < 0)
Quoted 6 lines
init/do_mounts.h extern int root_mountflags; · line 22
Quoted 1 line
init/do_mounts.h +1
-0+printk (KERN_ERR " Failed to create %s device !! err: %d\n" , name, ret);Don't need space before 'Failed'.
init/do_mounts.h extern int root_mountflags; · line 24
Quoted 2 lines
init/do_mounts.h +1
-0+return ret; }
Yup.
And there's no reason for it to be inlined. Let's move it into do_mounts.c please.