@@ -304,12 +304,18 @@ int rtrs_srv_create_path_files(struct rtrs_srv_path *srv_path)
void rtrs_srv_destroy_path_files(struct rtrs_srv_path *srv_path)
{
- if (srv_path->kobj.state_in_sysfs) {
+ if (srv_path->stats->kobj_stats.state_in_sysfs) {
+ sysfs_remove_group(&srv_path->stats->kobj_stats,
+ &rtrs_srv_stats_attr_group);
kobject_del(&srv_path->stats->kobj_stats);
kobject_put(&srv_path->stats->kobj_stats);
+ }
+
+ if (srv_path->kobj.state_in_sysfs) {
sysfs_remove_group(&srv_path->kobj, &rtrs_srv_path_attr_group);
+ kobject_del(&srv_path->kobj);
kobject_put(&srv_path->kobj);
-
- rtrs_srv_destroy_once_sysfs_root_folders(srv_path);
}
+
+ rtrs_srv_destroy_once_sysfs_root_folders(srv_path);
}