linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm:vmstat - Removed debug fs entries on failure of file creation and made extfrag_debug_root dentry local
@ 2012-04-23 21:29 Sasikantha babu
  2012-04-23 21:37 ` David Rientjes
  2012-04-24  8:47 ` Mel Gorman
  0 siblings, 2 replies; 3+ messages in thread
From: Sasikantha babu @ 2012-04-23 21:29 UTC (permalink / raw)
  To: Andrew Morton, Mel Gorman, Christoph Lameter, David Rientjes,
	KOSAKI Motohiro
  Cc: linux-mm, linux-kernel, Sasikantha babu

Removed debug fs files and directory on failure. Since no one using "extfrag_debug_root" dentry outside of function
extfrag_debug_init made it local to the function.

Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
---
 mm/vmstat.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index f600557..41447fc 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1220,7 +1220,6 @@ module_init(setup_vmstat)
 #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)
 #include <linux/debugfs.h>
 
-static struct dentry *extfrag_debug_root;
 
 /*
  * Return an index indicating how much of the available free memory is
@@ -1358,19 +1357,24 @@ static const struct file_operations extfrag_file_ops = {
 
 static int __init extfrag_debug_init(void)
 {
+	struct dentry *extfrag_debug_root;
+
 	extfrag_debug_root = debugfs_create_dir("extfrag", NULL);
 	if (!extfrag_debug_root)
 		return -ENOMEM;
 
 	if (!debugfs_create_file("unusable_index", 0444,
 			extfrag_debug_root, NULL, &unusable_file_ops))
-		return -ENOMEM;
+		goto fail;
 
 	if (!debugfs_create_file("extfrag_index", 0444,
 			extfrag_debug_root, NULL, &extfrag_file_ops))
-		return -ENOMEM;
+		goto fail;
 
 	return 0;
+fail:
+	debugfs_remove_recursive(extfrag_debug_root);
+	return -ENOMEM;
 }
 
 module_init(extfrag_debug_init);
-- 
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] 3+ messages in thread

end of thread, other threads:[~2012-04-24  8:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-23 21:29 [PATCH v2] mm:vmstat - Removed debug fs entries on failure of file creation and made extfrag_debug_root dentry local Sasikantha babu
2012-04-23 21:37 ` David Rientjes
2012-04-24  8:47 ` Mel Gorman

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