linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] init/do_mounts: Add create_dev() failure log
       [not found] <130285@samsung.com>
@ 2015-05-25  5:17 ` Vishnu Pratap Singh
  2015-05-25 12:59   ` Pavel Machek
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Vishnu Pratap Singh @ 2015-05-25  5:17 UTC (permalink / raw)
  To: paul.gortmaker, snitzer, dehrenberg, pavel, akpm, mszeredi, linux-kernel
  Cc: cpgs, 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 <vishnu.ps@samsung.com>
---
 init/do_mounts.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 8369ffa..a68aaf6 100644
--- 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)
+		printk(KERN_ERR "Failed to create %s device !!\n", "/dev/root");
 	mount_block_root("/dev/root", root_mountflags);
 #endif
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] init/do_mounts: Add create_dev() failure log
  2015-05-25  5:17 ` [PATCH] init/do_mounts: Add create_dev() failure log Vishnu Pratap Singh
@ 2015-05-25 12:59   ` Pavel Machek
  2015-05-25 13:49   ` Vishnu Pratap Singh
  2015-05-26  6:26   ` [PATCHv2] " Vishnu Pratap Singh
  2 siblings, 0 replies; 10+ messages in thread
From: Pavel Machek @ 2015-05-25 12:59 UTC (permalink / raw)
  To: Vishnu Pratap Singh
  Cc: paul.gortmaker, snitzer, dehrenberg, akpm, mszeredi, linux-kernel, cpgs

On Mon 2015-05-25 10:47:50, Vishnu Pratap Singh 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.
> 
> Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com>

Acked-by: Pavel Machek <pavel@ucw.cz>

> ---
>  init/do_mounts.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/init/do_mounts.c b/init/do_mounts.c
> index 8369ffa..a68aaf6 100644
> --- 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)
> +		printk(KERN_ERR "Failed to create %s device !!\n", "/dev/root");

But please make it "if (" and " !!" -> "!"

Thanks,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] init/do_mounts: Add create_dev() failure log
  2015-05-25  5:17 ` [PATCH] init/do_mounts: Add create_dev() failure log 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
  2 siblings, 1 reply; 10+ messages in thread
From: Vishnu Pratap Singh @ 2015-05-25 13:49 UTC (permalink / raw)
  To: paul.gortmaker, snitzer, dehrenberg, pavel, akpm, mszeredi, linux-kernel
  Cc: cpgs, 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 <vishnu.ps@samsung.com>
---
 init/do_mounts.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 8369ffa..a68aaf6 100644
--- 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)
+		printk(KERN_ERR "Failed to create %s device !!\n", "/dev/root");
 	mount_block_root("/dev/root", root_mountflags);
 #endif
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] init/do_mounts: Add create_dev() failure log
  2015-05-25 13:49   ` Vishnu Pratap Singh
@ 2015-05-26  6:25     ` Pavel Machek
  0 siblings, 0 replies; 10+ messages in thread
From: Pavel Machek @ 2015-05-26  6:25 UTC (permalink / raw)
  To: Vishnu Pratap Singh
  Cc: paul.gortmaker, snitzer, dehrenberg, akpm, mszeredi, linux-kernel, cpgs

On Mon 2015-05-25 19:19:43, Vishnu Pratap Singh 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.
> 
> Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com>
> ---
>  init/do_mounts.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/init/do_mounts.c b/init/do_mounts.c
> index 8369ffa..a68aaf6 100644
> --- 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)
> +		printk(KERN_ERR "Failed to create %s device !!\n", "/dev/root");

No change, AFAICT. Please fix stuff I pointed in the email, and you
can get my acked-by ;-).
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCHv2] init/do_mounts: Add create_dev() failure log
  2015-05-25  5:17 ` [PATCH] init/do_mounts: Add create_dev() failure log Vishnu Pratap Singh
  2015-05-25 12:59   ` Pavel Machek
  2015-05-25 13:49   ` Vishnu Pratap Singh
@ 2015-05-26  6:26   ` Vishnu Pratap Singh
  2015-05-26  8:32     ` Pavel Machek
  2015-05-27 23:27     ` Andrew Morton
  2 siblings, 2 replies; 10+ messages in thread
From: Vishnu Pratap Singh @ 2015-05-26  6:26 UTC (permalink / raw)
  To: paul.gortmaker, snitzer, dehrenberg, pavel, akpm, mszeredi, linux-kernel
  Cc: cpgs, 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 <vishnu.ps@samsung.com>
---
As per the review comment.

 init/do_mounts.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 8369ffa..f742250 100644
--- 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");
 	mount_block_root("/dev/root", root_mountflags);
 #endif
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] init/do_mounts: Add create_dev() failure log
  2015-05-26  6:26   ` [PATCHv2] " Vishnu Pratap Singh
@ 2015-05-26  8:32     ` Pavel Machek
  2015-05-27 23:27     ` Andrew Morton
  1 sibling, 0 replies; 10+ messages in thread
From: Pavel Machek @ 2015-05-26  8:32 UTC (permalink / raw)
  To: Vishnu Pratap Singh
  Cc: paul.gortmaker, snitzer, dehrenberg, akpm, mszeredi, linux-kernel, cpgs

On Tue 2015-05-26 11:56:58, Vishnu Pratap Singh 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.
> 
> Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com>

Acked-by: Pavel Machek <pavel@ucw.cz>

> ---
> As per the review comment.
> 
>  init/do_mounts.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/init/do_mounts.c b/init/do_mounts.c
> index 8369ffa..f742250 100644
> --- 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");
>  	mount_block_root("/dev/root", root_mountflags);
>  #endif
>  }

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] init/do_mounts: Add create_dev() failure log
  2015-05-26  6:26   ` [PATCHv2] " Vishnu Pratap Singh
  2015-05-26  8:32     ` Pavel Machek
@ 2015-05-27 23:27     ` Andrew Morton
  1 sibling, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2015-05-27 23:27 UTC (permalink / raw)
  To: Vishnu Pratap Singh
  Cc: paul.gortmaker, snitzer, dehrenberg, pavel, mszeredi, linux-kernel, cpgs

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
 }
 
_


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] init/do_mounts: Add create_dev() failure log
  2015-05-22 16:48 ` Randy Dunlap
@ 2015-05-22 19:44   ` Andrew Morton
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2015-05-22 19:44 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Vishnu Pratap Singh, linux-kernel, cpgs

On Fri, 22 May 2015 09:48:24 -0700 Randy Dunlap <rdunlap@infradead.org> wrote:

> On 05/22/15 05:37, Vishnu Pratap Singh 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.
> > 
> > Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com>
> > ---
> >  init/do_mounts.h |    6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/init/do_mounts.h b/init/do_mounts.h
> > index f5b978a..40c85e9 100644
> > --- a/init/do_mounts.h
> > +++ b/init/do_mounts.h
> > @@ -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)
> 
> > +		printk(KERN_ERR " Failed to create %s device !! err: %d\n", name, ret);
> 
> Don't need space before 'Failed'.
> 
> > +	return ret;
> >  }

Yup.

And there's no reason for it to be inlined.  Let's move it into
do_mounts.c please.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] init/do_mounts: Add create_dev() failure log
  2015-05-22 12:37 [PATCH] " Vishnu Pratap Singh
@ 2015-05-22 16:48 ` Randy Dunlap
  2015-05-22 19:44   ` Andrew Morton
  0 siblings, 1 reply; 10+ messages in thread
From: Randy Dunlap @ 2015-05-22 16:48 UTC (permalink / raw)
  To: Vishnu Pratap Singh, akpm, linux-kernel; +Cc: cpgs

On 05/22/15 05:37, Vishnu Pratap Singh 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.
> 
> Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com>
> ---
>  init/do_mounts.h |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/init/do_mounts.h b/init/do_mounts.h
> index f5b978a..40c85e9 100644
> --- a/init/do_mounts.h
> +++ b/init/do_mounts.h
> @@ -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)

> +		printk(KERN_ERR " Failed to create %s device !! err: %d\n", name, ret);

Don't need space before 'Failed'.

> +	return ret;
>  }
>  
>  #if BITS_PER_LONG == 32
> 


-- 
~Randy

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] init/do_mounts: Add create_dev() failure log
@ 2015-05-22 12:37 Vishnu Pratap Singh
  2015-05-22 16:48 ` Randy Dunlap
  0 siblings, 1 reply; 10+ messages in thread
From: Vishnu Pratap Singh @ 2015-05-22 12:37 UTC (permalink / raw)
  To: vishnu.ps, akpm, linux-kernel; +Cc: cpgs

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 <vishnu.ps@samsung.com>
---
 init/do_mounts.h |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/init/do_mounts.h b/init/do_mounts.h
index f5b978a..40c85e9 100644
--- a/init/do_mounts.h
+++ b/init/do_mounts.h
@@ -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
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-05-27 23:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <130285@samsung.com>
2015-05-25  5:17 ` [PATCH] init/do_mounts: Add create_dev() failure log 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
2015-05-22 12:37 [PATCH] " Vishnu Pratap Singh
2015-05-22 16:48 ` Randy Dunlap
2015-05-22 19:44   ` Andrew Morton

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).