Commit bde8bd8a1d5242589ddcaef8e017b48b207c4729

Authored by Sasikantha babu
Committed by Linus Torvalds
1 parent 7edc8b0ac1

mm/vmstat.c: remove debug fs entries on failure of file creation and made extfra…

…g_debug_root dentry local

Remove debug fs files and directory on failure.  Since no one is using
"extfrag_debug_root" dentry outside of extfrag_debug_init(), make it
local to the function.

Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff

... ... @@ -1223,7 +1223,6 @@
1223 1223 #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)
1224 1224 #include <linux/debugfs.h>
1225 1225  
1226   -static struct dentry *extfrag_debug_root;
1227 1226  
1228 1227 /*
1229 1228 * Return an index indicating how much of the available free memory is
1230 1229  
1231 1230  
1232 1231  
... ... @@ -1361,19 +1360,24 @@
1361 1360  
1362 1361 static int __init extfrag_debug_init(void)
1363 1362 {
  1363 + struct dentry *extfrag_debug_root;
  1364 +
1364 1365 extfrag_debug_root = debugfs_create_dir("extfrag", NULL);
1365 1366 if (!extfrag_debug_root)
1366 1367 return -ENOMEM;
1367 1368  
1368 1369 if (!debugfs_create_file("unusable_index", 0444,
1369 1370 extfrag_debug_root, NULL, &unusable_file_ops))
1370   - return -ENOMEM;
  1371 + goto fail;
1371 1372  
1372 1373 if (!debugfs_create_file("extfrag_index", 0444,
1373 1374 extfrag_debug_root, NULL, &extfrag_file_ops))
1374   - return -ENOMEM;
  1375 + goto fail;
1375 1376  
1376 1377 return 0;
  1378 +fail:
  1379 + debugfs_remove_recursive(extfrag_debug_root);
  1380 + return -ENOMEM;
1377 1381 }
1378 1382  
1379 1383 module_init(extfrag_debug_init);