summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c6f3d53)
The function lnet_router_debugfs_remove() is suppose to cleanup
the lnet specific debugfs files but that is not happening at all.
Change lnet_remove_debugfs() from doing the final debugfs lnet
and libcfs cleanup to doing specific debugfs file removal. We
can make libcfs module unloading to directly finish the entire
libcfs and debugfs tree removal instead. With this change we can
make lnet_router_debugfs_fini() call lnet_remove_debugfs().
Change-Id: I9e314e7efde806073b621166ff2e1b344e550875
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/34669
Reviewed-by: Sonia Sharma <sharmaso@whamcloud.com>
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
-void lnet_insert_debugfs(struct ctl_table *table,
- const struct lnet_debugfs_symlink_def *symlinks);
+void lnet_insert_debugfs(struct ctl_table *table);
+void lnet_remove_debugfs(struct ctl_table *table);
/* helper for sysctl handlers */
int lprocfs_call_handler(void *data, int write, loff_t *ppos,
/* helper for sysctl handlers */
int lprocfs_call_handler(void *data, int write, loff_t *ppos,
return &lnet_debugfs_file_operations_rw;
}
return &lnet_debugfs_file_operations_rw;
}
-void lnet_insert_debugfs(struct ctl_table *table,
- const struct lnet_debugfs_symlink_def *symlinks)
+void lnet_insert_debugfs(struct ctl_table *table)
{
if (!lnet_debugfs_root)
lnet_debugfs_root = debugfs_create_dir("lnet", NULL);
{
if (!lnet_debugfs_root)
lnet_debugfs_root = debugfs_create_dir("lnet", NULL);
debugfs_create_file(table->procname, table->mode,
lnet_debugfs_root, table,
lnet_debugfs_fops_select(table->mode));
debugfs_create_file(table->procname, table->mode,
lnet_debugfs_root, table,
lnet_debugfs_fops_select(table->mode));
+}
+EXPORT_SYMBOL_GPL(lnet_insert_debugfs);
+static void lnet_insert_debugfs_links(
+ const struct lnet_debugfs_symlink_def *symlinks)
+{
for (; symlinks && symlinks->name; symlinks++)
debugfs_create_symlink(symlinks->name, lnet_debugfs_root,
symlinks->target);
}
for (; symlinks && symlinks->name; symlinks++)
debugfs_create_symlink(symlinks->name, lnet_debugfs_root,
symlinks->target);
}
-EXPORT_SYMBOL_GPL(lnet_insert_debugfs);
-static void lnet_remove_debugfs(void)
+void lnet_remove_debugfs(struct ctl_table *table)
- debugfs_remove_recursive(lnet_debugfs_root);
+ for (; table && table->procname; table++) {
+ struct qstr dname = QSTR_INIT(table->procname,
+ strlen(table->procname));
+ struct dentry *dentry;
- lnet_debugfs_root = NULL;
+ dentry = d_hash_and_lookup(lnet_debugfs_root, &dname);
+ debugfs_remove(dentry);
+ }
+EXPORT_SYMBOL_GPL(lnet_remove_debugfs);
static int __init libcfs_init(void)
{
static int __init libcfs_init(void)
{
- lnet_insert_debugfs(lnet_table, lnet_debugfs_symlinks);
+ lnet_insert_debugfs(lnet_table);
+ if (!IS_ERR_OR_NULL(lnet_debugfs_root))
+ lnet_insert_debugfs_links(lnet_debugfs_symlinks);
CDEBUG (D_OTHER, "portals setup OK\n");
return 0;
CDEBUG (D_OTHER, "portals setup OK\n");
return 0;
+ /* Remove everthing */
+ debugfs_remove_recursive(lnet_debugfs_root);
+ lnet_debugfs_root = NULL;
CDEBUG(D_MALLOC, "before Portals cleanup: kmem %d\n",
atomic_read(&libcfs_kmemory));
CDEBUG(D_MALLOC, "before Portals cleanup: kmem %d\n",
atomic_read(&libcfs_kmemory));
- lnet_router_debugfs_init();
+ lnet_router_debugfs_fini();
lnet_peer_discovery_stop();
lnet_push_target_fini();
lnet_monitor_thr_stop();
lnet_peer_discovery_stop();
lnet_push_target_fini();
lnet_monitor_thr_stop();
void lnet_router_debugfs_init(void)
{
void lnet_router_debugfs_init(void)
{
- lnet_insert_debugfs(lnet_table, NULL);
+ lnet_insert_debugfs(lnet_table);
+}
+
+void lnet_router_debugfs_fini(void)
+{
+ lnet_remove_debugfs(lnet_table);