* [PATCH 2/2] mm: memblock - Handled failure of debug fs entries creation
@ 2012-04-25 19:59 ` Sasikantha babu
0 siblings, 0 replies; 8+ messages in thread
From: Sasikantha babu @ 2012-04-25 19:59 UTC (permalink / raw)
To: Tejun Heo, H. Peter Anvin, Andrew Morton, Ingo Molnar
Cc: linux-mm, linux-kernel, Sasikantha babu
1) Removed already created debug fs entries on failure
2) Fixed coding style 80 char per line
Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
---
mm/memblock.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index a44eab3..5553723 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -966,11 +966,19 @@ static int __init memblock_init_debugfs(void)
{
struct dentry *root = debugfs_create_dir("memblock", NULL);
if (!root)
- return -ENXIO;
- debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops);
- debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops);
+ return -ENOMEM;
+
+ if (!debugfs_create_file("memory", S_IRUGO, root, &memblock.memory,
+ &memblock_debug_fops))
+ goto fail;
+ if (!debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved,
+ &memblock_debug_fops))
+ goto fail;
return 0;
+fail:
+ debugfs_remove_recursive(root);
+ return -ENOMEM;
}
__initcall(memblock_init_debugfs);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] mm: memblock - Handled failure of debug fs entries creation
@ 2012-04-25 19:59 ` Sasikantha babu
0 siblings, 0 replies; 8+ messages in thread
From: Sasikantha babu @ 2012-04-25 19:59 UTC (permalink / raw)
To: Tejun Heo, H. Peter Anvin, Andrew Morton, Ingo Molnar
Cc: linux-mm, linux-kernel, Sasikantha babu
1) Removed already created debug fs entries on failure
2) Fixed coding style 80 char per line
Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
---
mm/memblock.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index a44eab3..5553723 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -966,11 +966,19 @@ static int __init memblock_init_debugfs(void)
{
struct dentry *root = debugfs_create_dir("memblock", NULL);
if (!root)
- return -ENXIO;
- debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops);
- debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops);
+ return -ENOMEM;
+
+ if (!debugfs_create_file("memory", S_IRUGO, root, &memblock.memory,
+ &memblock_debug_fops))
+ goto fail;
+ if (!debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved,
+ &memblock_debug_fops))
+ goto fail;
return 0;
+fail:
+ debugfs_remove_recursive(root);
+ return -ENOMEM;
}
__initcall(memblock_init_debugfs);
--
1.7.3.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] mm: memblock - Handled failure of debug fs entries creation
2012-04-25 19:59 ` Sasikantha babu
@ 2012-04-26 23:21 ` Andrew Morton
-1 siblings, 0 replies; 8+ messages in thread
From: Andrew Morton @ 2012-04-26 23:21 UTC (permalink / raw)
To: Sasikantha babu
Cc: Tejun Heo, H. Peter Anvin, Ingo Molnar, linux-mm, linux-kernel
On Thu, 26 Apr 2012 01:29:52 +0530
Sasikantha babu <sasikanth.v19@gmail.com> wrote:
> 1) Removed already created debug fs entries on failure
>
> 2) Fixed coding style 80 char per line
>
> Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
> ---
> mm/memblock.c | 14 +++++++++++---
> 1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index a44eab3..5553723 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -966,11 +966,19 @@ static int __init memblock_init_debugfs(void)
> {
> struct dentry *root = debugfs_create_dir("memblock", NULL);
> if (!root)
> - return -ENXIO;
> - debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops);
> - debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops);
> + return -ENOMEM;
hm, why the switch to -ENOMEM?
Fact is, debugfs_create_dir() and debugfs_create_file() are stupid
interfaces which don't provide the caller (and hence the user) with any
information about why they failed. Perhaps memblock_init_debugfs()
should return -EWESUCK.
> + if (!debugfs_create_file("memory", S_IRUGO, root, &memblock.memory,
> + &memblock_debug_fops))
> + goto fail;
> + if (!debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved,
> + &memblock_debug_fops))
> + goto fail;
>
> return 0;
> +fail:
> + debugfs_remove_recursive(root);
> + return -ENOMEM;
> }
> __initcall(memblock_init_debugfs);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] mm: memblock - Handled failure of debug fs entries creation
@ 2012-04-26 23:21 ` Andrew Morton
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Morton @ 2012-04-26 23:21 UTC (permalink / raw)
To: Sasikantha babu
Cc: Tejun Heo, H. Peter Anvin, Ingo Molnar, linux-mm, linux-kernel
On Thu, 26 Apr 2012 01:29:52 +0530
Sasikantha babu <sasikanth.v19@gmail.com> wrote:
> 1) Removed already created debug fs entries on failure
>
> 2) Fixed coding style 80 char per line
>
> Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
> ---
> mm/memblock.c | 14 +++++++++++---
> 1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index a44eab3..5553723 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -966,11 +966,19 @@ static int __init memblock_init_debugfs(void)
> {
> struct dentry *root = debugfs_create_dir("memblock", NULL);
> if (!root)
> - return -ENXIO;
> - debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops);
> - debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops);
> + return -ENOMEM;
hm, why the switch to -ENOMEM?
Fact is, debugfs_create_dir() and debugfs_create_file() are stupid
interfaces which don't provide the caller (and hence the user) with any
information about why they failed. Perhaps memblock_init_debugfs()
should return -EWESUCK.
> + if (!debugfs_create_file("memory", S_IRUGO, root, &memblock.memory,
> + &memblock_debug_fops))
> + goto fail;
> + if (!debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved,
> + &memblock_debug_fops))
> + goto fail;
>
> return 0;
> +fail:
> + debugfs_remove_recursive(root);
> + return -ENOMEM;
> }
> __initcall(memblock_init_debugfs);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] mm: memblock - Handled failure of debug fs entries creation
2012-04-26 23:21 ` Andrew Morton
(?)
@ 2012-04-28 19:02 ` Sasikanth babu
2012-04-28 19:06 ` Andrew Morton
-1 siblings, 1 reply; 8+ messages in thread
From: Sasikanth babu @ 2012-04-28 19:02 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, H. Peter Anvin, Ingo Molnar, linux-mm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2190 bytes --]
On Fri, Apr 27, 2012 at 4:51 AM, Andrew Morton <akpm@linux-foundation.org>wrote:
> On Thu, 26 Apr 2012 01:29:52 +0530
> Sasikantha babu <sasikanth.v19@gmail.com> wrote:
>
> > 1) Removed already created debug fs entries on failure
> >
> > 2) Fixed coding style 80 char per line
> >
> > Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
> > ---
> > mm/memblock.c | 14 +++++++++++---
> > 1 files changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/mm/memblock.c b/mm/memblock.c
> > index a44eab3..5553723 100644
> > --- a/mm/memblock.c
> > +++ b/mm/memblock.c
> > @@ -966,11 +966,19 @@ static int __init memblock_init_debugfs(void)
> > {
> > struct dentry *root = debugfs_create_dir("memblock", NULL);
> > if (!root)
> > - return -ENXIO;
> > - debugfs_create_file("memory", S_IRUGO, root, &memblock.memory,
> &memblock_debug_fops);
> > - debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved,
> &memblock_debug_fops);
> > + return -ENOMEM;
>
> hm, why the switch to -ENOMEM?
>
> Just for consistency (But its dumb mistake I made).
> Fact is, debugfs_create_dir() and debugfs_create_file() are stupid
> interfaces which don't provide the caller (and hence the user) with any
> information about why they failed. Perhaps memblock_init_debugfs()
> should return -EWESUCK.
>
I'm working on a patch which address this issue. debugfs_create_XXX
calls
will return proper error codes, and fixing the existing code not each
and every part but the code
which handles the values returned by debufs_create_XXX otherwise it will
break the existing
functionality . (any suggestions or opinions ?)
.
Thanks
Sasi
>
> > + if (!debugfs_create_file("memory", S_IRUGO, root, &memblock.memory,
> > + &memblock_debug_fops))
> > + goto fail;
> > + if (!debugfs_create_file("reserved", S_IRUGO, root,
> &memblock.reserved,
> > + &memblock_debug_fops))
> > + goto fail;
> >
> > return 0;
> > +fail:
> > + debugfs_remove_recursive(root);
> > + return -ENOMEM;
> > }
> > __initcall(memblock_init_debugfs);
>
>
[-- Attachment #2: Type: text/html, Size: 3292 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] mm: memblock - Handled failure of debug fs entries creation
2012-04-28 19:02 ` Sasikanth babu
@ 2012-04-28 19:06 ` Andrew Morton
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Morton @ 2012-04-28 19:06 UTC (permalink / raw)
To: Sasikanth babu
Cc: Tejun Heo, H. Peter Anvin, Ingo Molnar, linux-mm, linux-kernel
On Sun, 29 Apr 2012 00:32:26 +0530 Sasikanth babu <sasikanth.v19@gmail.com> wrote:
> > Fact is, debugfs_create_dir() and debugfs_create_file() are stupid
> > interfaces which don't provide the caller (and hence the user) with any
> > information about why they failed. Perhaps memblock_init_debugfs()
> > should return -EWESUCK.
> >
>
> I'm working on a patch which address this issue. debugfs_create_XXX
> calls
> will return proper error codes, and fixing the existing code not each
> and every part but the code
> which handles the values returned by debufs_create_XXX otherwise it will
> break the existing
> functionality .
Excellent!
> (any suggestions or opinions ?)
Well, don't modify the existing interfaces: create new ones and we can
migrate gradually. But you're probably already doing that.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] mm: memblock - Handled failure of debug fs entries creation
@ 2012-04-28 19:06 ` Andrew Morton
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Morton @ 2012-04-28 19:06 UTC (permalink / raw)
To: Sasikanth babu
Cc: Tejun Heo, H. Peter Anvin, Ingo Molnar, linux-mm, linux-kernel
On Sun, 29 Apr 2012 00:32:26 +0530 Sasikanth babu <sasikanth.v19@gmail.com> wrote:
> > Fact is, debugfs_create_dir() and debugfs_create_file() are stupid
> > interfaces which don't provide the caller (and hence the user) with any
> > information about why they failed. Perhaps memblock_init_debugfs()
> > should return -EWESUCK.
> >
>
> I'm working on a patch which address this issue. debugfs_create_XXX
> calls
> will return proper error codes, and fixing the existing code not each
> and every part but the code
> which handles the values returned by debufs_create_XXX otherwise it will
> break the existing
> functionality .
Excellent!
> (any suggestions or opinions ?)
Well, don't modify the existing interfaces: create new ones and we can
migrate gradually. But you're probably already doing that.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] mm: memblock - Handled failure of debug fs entries creation
2012-04-28 19:06 ` Andrew Morton
(?)
@ 2012-04-28 19:45 ` Sasikanth babu
-1 siblings, 0 replies; 8+ messages in thread
From: Sasikanth babu @ 2012-04-28 19:45 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, H. Peter Anvin, Ingo Molnar, linux-mm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2035 bytes --]
On Sun, Apr 29, 2012 at 12:36 AM, Andrew Morton
<akpm@linux-foundation.org>wrote:
> On Sun, 29 Apr 2012 00:32:26 +0530 Sasikanth babu <sasikanth.v19@gmail.com>
> wrote:
>
> > > Fact is, debugfs_create_dir() and debugfs_create_file() are stupid
> > > interfaces which don't provide the caller (and hence the user) with any
> > > information about why they failed. Perhaps memblock_init_debugfs()
> > > should return -EWESUCK.
> > >
> >
> > I'm working on a patch which address this issue. debugfs_create_XXX
> > calls
> > will return proper error codes, and fixing the existing code not each
> > and every part but the code
> > which handles the values returned by debufs_create_XXX otherwise it
> will
> > break the existing
> > functionality .
>
> Excellent!
>
> > (any suggestions or opinions ?)
>
> Well, don't modify the existing interfaces: create new ones and we can
> migrate gradually. But you're probably already doing that.
>
Not going to change the existing interface. Modified debugfs_create_XXX
to return ERR_PTR(error) instead of NULL.
[sasikantha@localhost linux-2.6]$ git diff
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index b80bc84..f5a5783 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -378,7 +378,7 @@ struct dentry *debugfs_create_file(const char *name,
umode_t mode,
error = debugfs_create_by_name(name, mode, parent, &dentry,
data, fops);
if (error) {
- dentry = NULL;
+ dentry = ERR_PTR(error);
simple_release_fs(&debugfs_mount, &debugfs_mount_count);
goto exit;
}
And from the caller side modifying the code as shown below (Currently
started doing
modification for each subsystem)
dir = debugfs_create_dir("test", NULL);
if (IS_ERR(dir)) {
return PTR_ERR(dir);
}
I think as you had mentioned creating new interface and migrating
gradually is the right of
way of doing it.
Thanks
Sasi
[-- Attachment #2: Type: text/html, Size: 2684 bytes --]
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-04-28 19:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-25 19:59 [PATCH 2/2] mm: memblock - Handled failure of debug fs entries creation Sasikantha babu
2012-04-25 19:59 ` Sasikantha babu
2012-04-26 23:21 ` Andrew Morton
2012-04-26 23:21 ` Andrew Morton
2012-04-28 19:02 ` Sasikanth babu
2012-04-28 19:06 ` Andrew Morton
2012-04-28 19:06 ` Andrew Morton
2012-04-28 19:45 ` Sasikanth babu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.