linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] debugfs: provide pr_fmt() macro
@ 2019-07-03  7:16 Greg Kroah-Hartman
  2019-07-03  7:16 ` [PATCH 2/2] debugfs: log errors when something goes wrong Greg Kroah-Hartman
  2019-07-03  9:09 ` [PATCH 1/2] debugfs: provide pr_fmt() macro Rafael J. Wysocki
  0 siblings, 2 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-03  7:16 UTC (permalink / raw)
  To: Mark Brown, Takashi Iwai
  Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki

Use a common "debugfs: " prefix for all pr_* calls in a single place.

Cc: Mark Brown <broonie@kernel.org>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/debugfs/inode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index acef14ad53db..f04c8475d9a1 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -9,6 +9,8 @@
  *  See ./Documentation/core-api/kernel-api.rst for more details.
  */
 
+#define pr_fmt(fmt)	"debugfs: " fmt
+
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/mount.h>
@@ -285,7 +287,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
 	struct dentry *dentry;
 	int error;
 
-	pr_debug("debugfs: creating file '%s'\n",name);
+	pr_debug("creating file '%s'\n", name);
 
 	if (IS_ERR(parent))
 		return parent;
-- 
2.22.0


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

* [PATCH 2/2] debugfs: log errors when something goes wrong
  2019-07-03  7:16 [PATCH 1/2] debugfs: provide pr_fmt() macro Greg Kroah-Hartman
@ 2019-07-03  7:16 ` Greg Kroah-Hartman
  2019-07-03  9:10   ` Rafael J. Wysocki
  2019-07-03 11:43   ` Mark Brown
  2019-07-03  9:09 ` [PATCH 1/2] debugfs: provide pr_fmt() macro Rafael J. Wysocki
  1 sibling, 2 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-03  7:16 UTC (permalink / raw)
  To: Mark Brown, Takashi Iwai
  Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki

As it is not recommended that debugfs calls be checked, it was pointed
out that major errors should still be logged somewhere so that
developers and users have a chance to figure out what went wrong.  To
help with this, error logging has been added to the debugfs core so that
it is not needed to be present in every individual file that calls
debugfs.

Reported-by: Mark Brown <broonie@kernel.org>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/debugfs/inode.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index f04c8475d9a1..7f43c8acfcbf 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -2,8 +2,9 @@
 /*
  *  inode.c - part of debugfs, a tiny little debug file system
  *
- *  Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
+ *  Copyright (C) 2004,2019 Greg Kroah-Hartman <greg@kroah.com>
  *  Copyright (C) 2004 IBM Inc.
+ *  Copyright (C) 2019 Linux Foundation <gregkh@linuxfoundation.org>
  *
  *  debugfs is for people to use instead of /proc or /sys.
  *  See ./Documentation/core-api/kernel-api.rst for more details.
@@ -294,8 +295,10 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
 
 	error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
 			      &debugfs_mount_count);
-	if (error)
+	if (error) {
+		pr_err("Unable to pin filesystem for file '%s'\n", name);
 		return ERR_PTR(error);
+	}
 
 	/* If the parent is not specified, we create it in the root.
 	 * We need the root dentry to do this, which is in the super
@@ -309,6 +312,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
 	dentry = lookup_one_len(name, parent, strlen(name));
 	if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
 		dput(dentry);
+		pr_err("File '%s' already present!\n", name);
 		dentry = ERR_PTR(-EEXIST);
 	}
 
@@ -351,8 +355,11 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
 		return dentry;
 
 	inode = debugfs_get_inode(dentry->d_sb);
-	if (unlikely(!inode))
+	if (unlikely(!inode)) {
+		pr_err("out of free dentries, can not create file '%s'\n",
+		       name);
 		return failed_creating(dentry);
+	}
 
 	inode->i_mode = mode;
 	inode->i_private = data;
@@ -513,8 +520,11 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
 		return dentry;
 
 	inode = debugfs_get_inode(dentry->d_sb);
-	if (unlikely(!inode))
+	if (unlikely(!inode)) {
+		pr_err("out of free dentries, can not create directory '%s'\n",
+		       name);
 		return failed_creating(dentry);
+	}
 
 	inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
 	inode->i_op = &simple_dir_inode_operations;
@@ -552,8 +562,11 @@ struct dentry *debugfs_create_automount(const char *name,
 		return dentry;
 
 	inode = debugfs_get_inode(dentry->d_sb);
-	if (unlikely(!inode))
+	if (unlikely(!inode)) {
+		pr_err("out of free dentries, can not create automount '%s'\n",
+		       name);
 		return failed_creating(dentry);
+	}
 
 	make_empty_dir_inode(inode);
 	inode->i_flags |= S_AUTOMOUNT;
@@ -608,6 +621,8 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
 
 	inode = debugfs_get_inode(dentry->d_sb);
 	if (unlikely(!inode)) {
+		pr_err("out of free dentries, can not create symlink '%s'\n",
+		       name);
 		kfree(link);
 		return failed_creating(dentry);
 	}
-- 
2.22.0


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

* Re: [PATCH 1/2] debugfs: provide pr_fmt() macro
  2019-07-03  7:16 [PATCH 1/2] debugfs: provide pr_fmt() macro Greg Kroah-Hartman
  2019-07-03  7:16 ` [PATCH 2/2] debugfs: log errors when something goes wrong Greg Kroah-Hartman
@ 2019-07-03  9:09 ` Rafael J. Wysocki
  1 sibling, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2019-07-03  9:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mark Brown, Takashi Iwai, Linux Kernel Mailing List, Rafael J. Wysocki

On Wed, Jul 3, 2019 at 9:17 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> Use a common "debugfs: " prefix for all pr_* calls in a single place.
>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  fs/debugfs/inode.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
> index acef14ad53db..f04c8475d9a1 100644
> --- a/fs/debugfs/inode.c
> +++ b/fs/debugfs/inode.c
> @@ -9,6 +9,8 @@
>   *  See ./Documentation/core-api/kernel-api.rst for more details.
>   */
>
> +#define pr_fmt(fmt)    "debugfs: " fmt
> +
>  #include <linux/module.h>
>  #include <linux/fs.h>
>  #include <linux/mount.h>
> @@ -285,7 +287,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
>         struct dentry *dentry;
>         int error;
>
> -       pr_debug("debugfs: creating file '%s'\n",name);
> +       pr_debug("creating file '%s'\n", name);
>
>         if (IS_ERR(parent))
>                 return parent;
> --
> 2.22.0
>

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

* Re: [PATCH 2/2] debugfs: log errors when something goes wrong
  2019-07-03  7:16 ` [PATCH 2/2] debugfs: log errors when something goes wrong Greg Kroah-Hartman
@ 2019-07-03  9:10   ` Rafael J. Wysocki
  2019-07-03  9:32     ` Greg Kroah-Hartman
  2019-07-03 11:43   ` Mark Brown
  1 sibling, 1 reply; 9+ messages in thread
From: Rafael J. Wysocki @ 2019-07-03  9:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mark Brown, Takashi Iwai, Linux Kernel Mailing List, Rafael J. Wysocki

On Wed, Jul 3, 2019 at 9:17 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> As it is not recommended that debugfs calls be checked, it was pointed
> out that major errors should still be logged somewhere so that
> developers and users have a chance to figure out what went wrong.  To
> help with this, error logging has been added to the debugfs core so that
> it is not needed to be present in every individual file that calls
> debugfs.
>
> Reported-by: Mark Brown <broonie@kernel.org>
> Reported-by: Takashi Iwai <tiwai@suse.de>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Generally speaking

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  fs/debugfs/inode.c | 25 ++++++++++++++++++++-----
>  1 file changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
> index f04c8475d9a1..7f43c8acfcbf 100644
> --- a/fs/debugfs/inode.c
> +++ b/fs/debugfs/inode.c
> @@ -2,8 +2,9 @@
>  /*
>   *  inode.c - part of debugfs, a tiny little debug file system
>   *
> - *  Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
> + *  Copyright (C) 2004,2019 Greg Kroah-Hartman <greg@kroah.com>
>   *  Copyright (C) 2004 IBM Inc.
> + *  Copyright (C) 2019 Linux Foundation <gregkh@linuxfoundation.org>
>   *
>   *  debugfs is for people to use instead of /proc or /sys.
>   *  See ./Documentation/core-api/kernel-api.rst for more details.
> @@ -294,8 +295,10 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
>
>         error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
>                               &debugfs_mount_count);
> -       if (error)
> +       if (error) {
> +               pr_err("Unable to pin filesystem for file '%s'\n", name);

But I'm not sure about the log level here.  Particularly, why would
pr_info() not work?

>                 return ERR_PTR(error);
> +       }
>
>         /* If the parent is not specified, we create it in the root.
>          * We need the root dentry to do this, which is in the super
> @@ -309,6 +312,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
>         dentry = lookup_one_len(name, parent, strlen(name));
>         if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
>                 dput(dentry);
> +               pr_err("File '%s' already present!\n", name);
>                 dentry = ERR_PTR(-EEXIST);
>         }
>
> @@ -351,8 +355,11 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
>                 return dentry;
>
>         inode = debugfs_get_inode(dentry->d_sb);
> -       if (unlikely(!inode))
> +       if (unlikely(!inode)) {
> +               pr_err("out of free dentries, can not create file '%s'\n",
> +                      name);
>                 return failed_creating(dentry);
> +       }
>
>         inode->i_mode = mode;
>         inode->i_private = data;
> @@ -513,8 +520,11 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
>                 return dentry;
>
>         inode = debugfs_get_inode(dentry->d_sb);
> -       if (unlikely(!inode))
> +       if (unlikely(!inode)) {
> +               pr_err("out of free dentries, can not create directory '%s'\n",
> +                      name);
>                 return failed_creating(dentry);
> +       }
>
>         inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
>         inode->i_op = &simple_dir_inode_operations;
> @@ -552,8 +562,11 @@ struct dentry *debugfs_create_automount(const char *name,
>                 return dentry;
>
>         inode = debugfs_get_inode(dentry->d_sb);
> -       if (unlikely(!inode))
> +       if (unlikely(!inode)) {
> +               pr_err("out of free dentries, can not create automount '%s'\n",
> +                      name);
>                 return failed_creating(dentry);
> +       }
>
>         make_empty_dir_inode(inode);
>         inode->i_flags |= S_AUTOMOUNT;
> @@ -608,6 +621,8 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
>
>         inode = debugfs_get_inode(dentry->d_sb);
>         if (unlikely(!inode)) {
> +               pr_err("out of free dentries, can not create symlink '%s'\n",
> +                      name);
>                 kfree(link);
>                 return failed_creating(dentry);
>         }
> --
> 2.22.0
>

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

* Re: [PATCH 2/2] debugfs: log errors when something goes wrong
  2019-07-03  9:10   ` Rafael J. Wysocki
@ 2019-07-03  9:32     ` Greg Kroah-Hartman
  2019-07-03  9:35       ` Takashi Iwai
  2019-07-03  9:37       ` Rafael J. Wysocki
  0 siblings, 2 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-03  9:32 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Mark Brown, Takashi Iwai, Linux Kernel Mailing List

On Wed, Jul 03, 2019 at 11:10:44AM +0200, Rafael J. Wysocki wrote:
> On Wed, Jul 3, 2019 at 9:17 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > As it is not recommended that debugfs calls be checked, it was pointed
> > out that major errors should still be logged somewhere so that
> > developers and users have a chance to figure out what went wrong.  To
> > help with this, error logging has been added to the debugfs core so that
> > it is not needed to be present in every individual file that calls
> > debugfs.
> >
> > Reported-by: Mark Brown <broonie@kernel.org>
> > Reported-by: Takashi Iwai <tiwai@suse.de>
> > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> Generally speaking
> 
> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> > ---
> >  fs/debugfs/inode.c | 25 ++++++++++++++++++++-----
> >  1 file changed, 20 insertions(+), 5 deletions(-)
> >
> > diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
> > index f04c8475d9a1..7f43c8acfcbf 100644
> > --- a/fs/debugfs/inode.c
> > +++ b/fs/debugfs/inode.c
> > @@ -2,8 +2,9 @@
> >  /*
> >   *  inode.c - part of debugfs, a tiny little debug file system
> >   *
> > - *  Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
> > + *  Copyright (C) 2004,2019 Greg Kroah-Hartman <greg@kroah.com>
> >   *  Copyright (C) 2004 IBM Inc.
> > + *  Copyright (C) 2019 Linux Foundation <gregkh@linuxfoundation.org>
> >   *
> >   *  debugfs is for people to use instead of /proc or /sys.
> >   *  See ./Documentation/core-api/kernel-api.rst for more details.
> > @@ -294,8 +295,10 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
> >
> >         error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
> >                               &debugfs_mount_count);
> > -       if (error)
> > +       if (error) {
> > +               pr_err("Unable to pin filesystem for file '%s'\n", name);
> 
> But I'm not sure about the log level here.  Particularly, why would
> pr_info() not work?

It could, but it is an error in that debugfs didn't do what was asked of
it.  I really don't care either way, the odds of anyone ever seeing this
message is almost none :)

thanks,

greg k-h

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

* Re: [PATCH 2/2] debugfs: log errors when something goes wrong
  2019-07-03  9:32     ` Greg Kroah-Hartman
@ 2019-07-03  9:35       ` Takashi Iwai
  2019-07-03 14:53         ` Greg Kroah-Hartman
  2019-07-03  9:37       ` Rafael J. Wysocki
  1 sibling, 1 reply; 9+ messages in thread
From: Takashi Iwai @ 2019-07-03  9:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rafael J. Wysocki, Mark Brown, Linux Kernel Mailing List

On Wed, 03 Jul 2019 11:32:33 +0200,
Greg Kroah-Hartman wrote:
> 
> On Wed, Jul 03, 2019 at 11:10:44AM +0200, Rafael J. Wysocki wrote:
> > On Wed, Jul 3, 2019 at 9:17 AM Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org> wrote:
> > >
> > > As it is not recommended that debugfs calls be checked, it was pointed
> > > out that major errors should still be logged somewhere so that
> > > developers and users have a chance to figure out what went wrong.  To
> > > help with this, error logging has been added to the debugfs core so that
> > > it is not needed to be present in every individual file that calls
> > > debugfs.
> > >
> > > Reported-by: Mark Brown <broonie@kernel.org>
> > > Reported-by: Takashi Iwai <tiwai@suse.de>
> > > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > 
> > Generally speaking
> > 
> > Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > 
> > > ---
> > >  fs/debugfs/inode.c | 25 ++++++++++++++++++++-----
> > >  1 file changed, 20 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
> > > index f04c8475d9a1..7f43c8acfcbf 100644
> > > --- a/fs/debugfs/inode.c
> > > +++ b/fs/debugfs/inode.c
> > > @@ -2,8 +2,9 @@
> > >  /*
> > >   *  inode.c - part of debugfs, a tiny little debug file system
> > >   *
> > > - *  Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
> > > + *  Copyright (C) 2004,2019 Greg Kroah-Hartman <greg@kroah.com>
> > >   *  Copyright (C) 2004 IBM Inc.
> > > + *  Copyright (C) 2019 Linux Foundation <gregkh@linuxfoundation.org>
> > >   *
> > >   *  debugfs is for people to use instead of /proc or /sys.
> > >   *  See ./Documentation/core-api/kernel-api.rst for more details.
> > > @@ -294,8 +295,10 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
> > >
> > >         error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
> > >                               &debugfs_mount_count);
> > > -       if (error)
> > > +       if (error) {
> > > +               pr_err("Unable to pin filesystem for file '%s'\n", name);
> > 
> > But I'm not sure about the log level here.  Particularly, why would
> > pr_info() not work?
> 
> It could, but it is an error in that debugfs didn't do what was asked of
> it.  I really don't care either way, the odds of anyone ever seeing this
> message is almost none :)

Yes, that's an obvious error and I see no big reason to hide it.

For both:
  Reviewed-by: Takashi Iwai <tiwai@suse.de>


Thanks!

Takashi

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

* Re: [PATCH 2/2] debugfs: log errors when something goes wrong
  2019-07-03  9:32     ` Greg Kroah-Hartman
  2019-07-03  9:35       ` Takashi Iwai
@ 2019-07-03  9:37       ` Rafael J. Wysocki
  1 sibling, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2019-07-03  9:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rafael J. Wysocki, Mark Brown, Takashi Iwai, Linux Kernel Mailing List

On Wed, Jul 3, 2019 at 11:32 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Wed, Jul 03, 2019 at 11:10:44AM +0200, Rafael J. Wysocki wrote:
> > On Wed, Jul 3, 2019 at 9:17 AM Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org> wrote:
> > >
> > > As it is not recommended that debugfs calls be checked, it was pointed
> > > out that major errors should still be logged somewhere so that
> > > developers and users have a chance to figure out what went wrong.  To
> > > help with this, error logging has been added to the debugfs core so that
> > > it is not needed to be present in every individual file that calls
> > > debugfs.
> > >
> > > Reported-by: Mark Brown <broonie@kernel.org>
> > > Reported-by: Takashi Iwai <tiwai@suse.de>
> > > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >
> > Generally speaking
> >
> > Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > > ---
> > >  fs/debugfs/inode.c | 25 ++++++++++++++++++++-----
> > >  1 file changed, 20 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
> > > index f04c8475d9a1..7f43c8acfcbf 100644
> > > --- a/fs/debugfs/inode.c
> > > +++ b/fs/debugfs/inode.c
> > > @@ -2,8 +2,9 @@
> > >  /*
> > >   *  inode.c - part of debugfs, a tiny little debug file system
> > >   *
> > > - *  Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
> > > + *  Copyright (C) 2004,2019 Greg Kroah-Hartman <greg@kroah.com>
> > >   *  Copyright (C) 2004 IBM Inc.
> > > + *  Copyright (C) 2019 Linux Foundation <gregkh@linuxfoundation.org>
> > >   *
> > >   *  debugfs is for people to use instead of /proc or /sys.
> > >   *  See ./Documentation/core-api/kernel-api.rst for more details.
> > > @@ -294,8 +295,10 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
> > >
> > >         error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
> > >                               &debugfs_mount_count);
> > > -       if (error)
> > > +       if (error) {
> > > +               pr_err("Unable to pin filesystem for file '%s'\n", name);
> >
> > But I'm not sure about the log level here.  Particularly, why would
> > pr_info() not work?
>
> It could, but it is an error in that debugfs didn't do what was asked of
> it.  I really don't care either way, the odds of anyone ever seeing this
> message is almost none :)

Fair enough.

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

* Re: [PATCH 2/2] debugfs: log errors when something goes wrong
  2019-07-03  7:16 ` [PATCH 2/2] debugfs: log errors when something goes wrong Greg Kroah-Hartman
  2019-07-03  9:10   ` Rafael J. Wysocki
@ 2019-07-03 11:43   ` Mark Brown
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Brown @ 2019-07-03 11:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Takashi Iwai, linux-kernel, Rafael J. Wysocki

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

On Wed, Jul 03, 2019 at 09:16:53AM +0200, Greg Kroah-Hartman wrote:
> As it is not recommended that debugfs calls be checked, it was pointed
> out that major errors should still be logged somewhere so that
> developers and users have a chance to figure out what went wrong.  To
> help with this, error logging has been added to the debugfs core so that
> it is not needed to be present in every individual file that calls
> debugfs.

Reviewed-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 2/2] debugfs: log errors when something goes wrong
  2019-07-03  9:35       ` Takashi Iwai
@ 2019-07-03 14:53         ` Greg Kroah-Hartman
  0 siblings, 0 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-03 14:53 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Rafael J. Wysocki, Mark Brown, Linux Kernel Mailing List

On Wed, Jul 03, 2019 at 11:35:50AM +0200, Takashi Iwai wrote:
> On Wed, 03 Jul 2019 11:32:33 +0200,
> Greg Kroah-Hartman wrote:
> > 
> > On Wed, Jul 03, 2019 at 11:10:44AM +0200, Rafael J. Wysocki wrote:
> > > On Wed, Jul 3, 2019 at 9:17 AM Greg Kroah-Hartman
> > > <gregkh@linuxfoundation.org> wrote:
> > > >
> > > > As it is not recommended that debugfs calls be checked, it was pointed
> > > > out that major errors should still be logged somewhere so that
> > > > developers and users have a chance to figure out what went wrong.  To
> > > > help with this, error logging has been added to the debugfs core so that
> > > > it is not needed to be present in every individual file that calls
> > > > debugfs.
> > > >
> > > > Reported-by: Mark Brown <broonie@kernel.org>
> > > > Reported-by: Takashi Iwai <tiwai@suse.de>
> > > > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > 
> > > Generally speaking
> > > 
> > > Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > 
> > > > ---
> > > >  fs/debugfs/inode.c | 25 ++++++++++++++++++++-----
> > > >  1 file changed, 20 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
> > > > index f04c8475d9a1..7f43c8acfcbf 100644
> > > > --- a/fs/debugfs/inode.c
> > > > +++ b/fs/debugfs/inode.c
> > > > @@ -2,8 +2,9 @@
> > > >  /*
> > > >   *  inode.c - part of debugfs, a tiny little debug file system
> > > >   *
> > > > - *  Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
> > > > + *  Copyright (C) 2004,2019 Greg Kroah-Hartman <greg@kroah.com>
> > > >   *  Copyright (C) 2004 IBM Inc.
> > > > + *  Copyright (C) 2019 Linux Foundation <gregkh@linuxfoundation.org>
> > > >   *
> > > >   *  debugfs is for people to use instead of /proc or /sys.
> > > >   *  See ./Documentation/core-api/kernel-api.rst for more details.
> > > > @@ -294,8 +295,10 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
> > > >
> > > >         error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
> > > >                               &debugfs_mount_count);
> > > > -       if (error)
> > > > +       if (error) {
> > > > +               pr_err("Unable to pin filesystem for file '%s'\n", name);
> > > 
> > > But I'm not sure about the log level here.  Particularly, why would
> > > pr_info() not work?
> > 
> > It could, but it is an error in that debugfs didn't do what was asked of
> > it.  I really don't care either way, the odds of anyone ever seeing this
> > message is almost none :)
> 
> Yes, that's an obvious error and I see no big reason to hide it.
> 
> For both:
>   Reviewed-by: Takashi Iwai <tiwai@suse.de>

Thanks all for the review, I'll go apply these to my tree now.

greg k-h

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

end of thread, other threads:[~2019-07-03 14:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03  7:16 [PATCH 1/2] debugfs: provide pr_fmt() macro Greg Kroah-Hartman
2019-07-03  7:16 ` [PATCH 2/2] debugfs: log errors when something goes wrong Greg Kroah-Hartman
2019-07-03  9:10   ` Rafael J. Wysocki
2019-07-03  9:32     ` Greg Kroah-Hartman
2019-07-03  9:35       ` Takashi Iwai
2019-07-03 14:53         ` Greg Kroah-Hartman
2019-07-03  9:37       ` Rafael J. Wysocki
2019-07-03 11:43   ` Mark Brown
2019-07-03  9:09 ` [PATCH 1/2] debugfs: provide pr_fmt() macro Rafael J. Wysocki

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