@@ -896,9 +896,18 @@ static struct attribute *orangefs_default_attrs[] = {
896896};
897897ATTRIBUTE_GROUPS (orangefs_default );
898898
899+ static struct kobject * orangefs_obj ;
900+
901+ static void orangefs_obj_release (struct kobject * kobj )
902+ {
903+ kfree (orangefs_obj );
904+ orangefs_obj = NULL ;
905+ }
906+
899907static struct kobj_type orangefs_ktype = {
900908 .sysfs_ops = & orangefs_sysfs_ops ,
901909 .default_groups = orangefs_default_groups ,
910+ .release = orangefs_obj_release ,
902911};
903912
904913static struct orangefs_attribute acache_hard_limit_attribute =
@@ -934,9 +943,18 @@ static struct attribute *acache_orangefs_default_attrs[] = {
934943};
935944ATTRIBUTE_GROUPS (acache_orangefs_default );
936945
946+ static struct kobject * acache_orangefs_obj ;
947+
948+ static void acache_orangefs_obj_release (struct kobject * kobj )
949+ {
950+ kfree (acache_orangefs_obj );
951+ acache_orangefs_obj = NULL ;
952+ }
953+
937954static struct kobj_type acache_orangefs_ktype = {
938955 .sysfs_ops = & orangefs_sysfs_ops ,
939956 .default_groups = acache_orangefs_default_groups ,
957+ .release = acache_orangefs_obj_release ,
940958};
941959
942960static struct orangefs_attribute capcache_hard_limit_attribute =
@@ -972,9 +990,18 @@ static struct attribute *capcache_orangefs_default_attrs[] = {
972990};
973991ATTRIBUTE_GROUPS (capcache_orangefs_default );
974992
993+ static struct kobject * capcache_orangefs_obj ;
994+
995+ static void capcache_orangefs_obj_release (struct kobject * kobj )
996+ {
997+ kfree (capcache_orangefs_obj );
998+ capcache_orangefs_obj = NULL ;
999+ }
1000+
9751001static struct kobj_type capcache_orangefs_ktype = {
9761002 .sysfs_ops = & orangefs_sysfs_ops ,
9771003 .default_groups = capcache_orangefs_default_groups ,
1004+ .release = capcache_orangefs_obj_release ,
9781005};
9791006
9801007static struct orangefs_attribute ccache_hard_limit_attribute =
@@ -1010,9 +1037,18 @@ static struct attribute *ccache_orangefs_default_attrs[] = {
10101037};
10111038ATTRIBUTE_GROUPS (ccache_orangefs_default );
10121039
1040+ static struct kobject * ccache_orangefs_obj ;
1041+
1042+ static void ccache_orangefs_obj_release (struct kobject * kobj )
1043+ {
1044+ kfree (ccache_orangefs_obj );
1045+ ccache_orangefs_obj = NULL ;
1046+ }
1047+
10131048static struct kobj_type ccache_orangefs_ktype = {
10141049 .sysfs_ops = & orangefs_sysfs_ops ,
10151050 .default_groups = ccache_orangefs_default_groups ,
1051+ .release = ccache_orangefs_obj_release ,
10161052};
10171053
10181054static struct orangefs_attribute ncache_hard_limit_attribute =
@@ -1048,9 +1084,18 @@ static struct attribute *ncache_orangefs_default_attrs[] = {
10481084};
10491085ATTRIBUTE_GROUPS (ncache_orangefs_default );
10501086
1087+ static struct kobject * ncache_orangefs_obj ;
1088+
1089+ static void ncache_orangefs_obj_release (struct kobject * kobj )
1090+ {
1091+ kfree (ncache_orangefs_obj );
1092+ ncache_orangefs_obj = NULL ;
1093+ }
1094+
10511095static struct kobj_type ncache_orangefs_ktype = {
10521096 .sysfs_ops = & orangefs_sysfs_ops ,
10531097 .default_groups = ncache_orangefs_default_groups ,
1098+ .release = ncache_orangefs_obj_release ,
10541099};
10551100
10561101static struct orangefs_attribute pc_acache_attribute =
@@ -1079,9 +1124,18 @@ static struct attribute *pc_orangefs_default_attrs[] = {
10791124};
10801125ATTRIBUTE_GROUPS (pc_orangefs_default );
10811126
1127+ static struct kobject * pc_orangefs_obj ;
1128+
1129+ static void pc_orangefs_obj_release (struct kobject * kobj )
1130+ {
1131+ kfree (pc_orangefs_obj );
1132+ pc_orangefs_obj = NULL ;
1133+ }
1134+
10821135static struct kobj_type pc_orangefs_ktype = {
10831136 .sysfs_ops = & orangefs_sysfs_ops ,
10841137 .default_groups = pc_orangefs_default_groups ,
1138+ .release = pc_orangefs_obj_release ,
10851139};
10861140
10871141static struct orangefs_attribute stats_reads_attribute =
@@ -1103,19 +1157,20 @@ static struct attribute *stats_orangefs_default_attrs[] = {
11031157};
11041158ATTRIBUTE_GROUPS (stats_orangefs_default );
11051159
1160+ static struct kobject * stats_orangefs_obj ;
1161+
1162+ static void stats_orangefs_obj_release (struct kobject * kobj )
1163+ {
1164+ kfree (stats_orangefs_obj );
1165+ stats_orangefs_obj = NULL ;
1166+ }
1167+
11061168static struct kobj_type stats_orangefs_ktype = {
11071169 .sysfs_ops = & orangefs_sysfs_ops ,
11081170 .default_groups = stats_orangefs_default_groups ,
1171+ .release = stats_orangefs_obj_release ,
11091172};
11101173
1111- static struct kobject * orangefs_obj ;
1112- static struct kobject * acache_orangefs_obj ;
1113- static struct kobject * capcache_orangefs_obj ;
1114- static struct kobject * ccache_orangefs_obj ;
1115- static struct kobject * ncache_orangefs_obj ;
1116- static struct kobject * pc_orangefs_obj ;
1117- static struct kobject * stats_orangefs_obj ;
1118-
11191174int orangefs_sysfs_init (void )
11201175{
11211176 int rc = - EINVAL ;
0 commit comments