Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
linux
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martyn Welch
linux
Commits
2180c52c
Commit
2180c52c
authored
9 years ago
by
Mike Marshall
Browse files
Options
Downloads
Patches
Plain Diff
Orangefs: fix sloppy cleanups of debugfs and sysfs init failures.
Signed-off-by:
Mike Marshall
<
hubcap@omnibond.com
>
parent
a7d3e78a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
fs/orangefs/orangefs-debugfs.c
+9
-11
9 additions, 11 deletions
fs/orangefs/orangefs-debugfs.c
fs/orangefs/orangefs-mod.c
+23
-6
23 additions, 6 deletions
fs/orangefs/orangefs-mod.c
fs/orangefs/orangefs-sysfs.c
+44
-45
44 additions, 45 deletions
fs/orangefs/orangefs-sysfs.c
with
76 additions
and
62 deletions
fs/orangefs/orangefs-debugfs.c
+
9
−
11
View file @
2180c52c
...
@@ -101,29 +101,32 @@ int orangefs_debugfs_init(void)
...
@@ -101,29 +101,32 @@ int orangefs_debugfs_init(void)
int
rc
=
-
ENOMEM
;
int
rc
=
-
ENOMEM
;
debug_dir
=
debugfs_create_dir
(
"orangefs"
,
NULL
);
debug_dir
=
debugfs_create_dir
(
"orangefs"
,
NULL
);
if
(
!
debug_dir
)
if
(
!
debug_dir
)
{
pr_info
(
"%s: debugfs_create_dir failed.
\n
"
,
__func__
);
goto
out
;
goto
out
;
}
help_file_dentry
=
debugfs_create_file
(
ORANGEFS_KMOD_DEBUG_HELP_FILE
,
help_file_dentry
=
debugfs_create_file
(
ORANGEFS_KMOD_DEBUG_HELP_FILE
,
0444
,
0444
,
debug_dir
,
debug_dir
,
debug_help_string
,
debug_help_string
,
&
debug_help_fops
);
&
debug_help_fops
);
if
(
!
help_file_dentry
)
if
(
!
help_file_dentry
)
{
pr_info
(
"%s: debugfs_create_file failed.
\n
"
,
__func__
);
goto
out
;
goto
out
;
}
orangefs_debug_disabled
=
0
;
orangefs_debug_disabled
=
0
;
rc
=
0
;
rc
=
0
;
out:
out:
if
(
rc
)
orangefs_debugfs_cleanup
();
return
rc
;
return
rc
;
}
}
void
orangefs_debugfs_cleanup
(
void
)
void
orangefs_debugfs_cleanup
(
void
)
{
{
if
(
debug_dir
)
debugfs_remove_recursive
(
debug_dir
);
debugfs_remove_recursive
(
debug_dir
);
}
}
...
@@ -198,7 +201,6 @@ static int help_show(struct seq_file *m, void *v)
...
@@ -198,7 +201,6 @@ static int help_show(struct seq_file *m, void *v)
*/
*/
int
orangefs_kernel_debug_init
(
void
)
int
orangefs_kernel_debug_init
(
void
)
{
{
int
rc
=
-
ENOMEM
;
int
rc
=
-
ENOMEM
;
struct
dentry
*
ret
;
struct
dentry
*
ret
;
char
*
k_buffer
=
NULL
;
char
*
k_buffer
=
NULL
;
...
@@ -232,8 +234,6 @@ int orangefs_kernel_debug_init(void)
...
@@ -232,8 +234,6 @@ int orangefs_kernel_debug_init(void)
rc
=
0
;
rc
=
0
;
out:
out:
if
(
rc
)
orangefs_debugfs_cleanup
();
gossip_debug
(
GOSSIP_DEBUGFS_DEBUG
,
"%s: rc:%d:
\n
"
,
__func__
,
rc
);
gossip_debug
(
GOSSIP_DEBUGFS_DEBUG
,
"%s: rc:%d:
\n
"
,
__func__
,
rc
);
return
rc
;
return
rc
;
...
@@ -268,7 +268,7 @@ int orangefs_client_debug_init(void)
...
@@ -268,7 +268,7 @@ int orangefs_client_debug_init(void)
c_buffer
,
c_buffer
,
&
kernel_debug_fops
);
&
kernel_debug_fops
);
if
(
!
client_debug_dentry
)
{
if
(
!
client_debug_dentry
)
{
pr_info
(
"%s: failed to create %s.
\n
"
,
pr_info
(
"%s: failed to create
updated
%s.
\n
"
,
__func__
,
__func__
,
ORANGEFS_CLIENT_DEBUG_FILE
);
ORANGEFS_CLIENT_DEBUG_FILE
);
goto
out
;
goto
out
;
...
@@ -277,8 +277,6 @@ int orangefs_client_debug_init(void)
...
@@ -277,8 +277,6 @@ int orangefs_client_debug_init(void)
rc
=
0
;
rc
=
0
;
out:
out:
if
(
rc
)
orangefs_debugfs_cleanup
();
gossip_debug
(
GOSSIP_DEBUGFS_DEBUG
,
"%s: rc:%d:
\n
"
,
__func__
,
rc
);
gossip_debug
(
GOSSIP_DEBUGFS_DEBUG
,
"%s: rc:%d:
\n
"
,
__func__
,
rc
);
return
rc
;
return
rc
;
...
...
This diff is collapsed.
Click to expand it.
fs/orangefs/orangefs-mod.c
+
23
−
6
View file @
2180c52c
...
@@ -185,22 +185,39 @@ static int __init orangefs_init(void)
...
@@ -185,22 +185,39 @@ static int __init orangefs_init(void)
*/
*/
ret
=
orangefs_prepare_debugfs_help_string
(
1
);
ret
=
orangefs_prepare_debugfs_help_string
(
1
);
if
(
ret
)
if
(
ret
)
goto
out
;
goto
prepare_helpstring_failed
;
ret
=
orangefs_debugfs_init
();
if
(
ret
)
goto
debugfs_init_failed
;
orangefs_debugfs_init
();
ret
=
orangefs_kernel_debug_init
();
orangefs_kernel_debug_init
();
if
(
ret
)
orangefs_sysfs_init
();
goto
kernel_debug_init_failed
;
ret
=
orangefs_sysfs_init
();
if
(
ret
)
goto
sysfs_init_failed
;
ret
=
register_filesystem
(
&
orangefs_fs_type
);
ret
=
register_filesystem
(
&
orangefs_fs_type
);
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
pr_info
(
"orangefs: module version %s loaded
\n
"
,
ORANGEFS_VERSION
);
pr_info
(
"orangefs: module version %s loaded
\n
"
,
ORANGEFS_VERSION
);
return
0
;
ret
=
0
;
goto
out
;
}
}
orangefs_debugfs_cleanup
();
orangefs_sysfs_exit
();
orangefs_sysfs_exit
();
fsid_key_table_finalize
();
fsid_key_table_finalize
();
sysfs_init_failed:
kernel_debug_init_failed:
debugfs_init_failed:
orangefs_debugfs_cleanup
();
prepare_helpstring_failed:
cleanup_progress_table:
cleanup_progress_table:
kfree
(
htable_ops_in_progress
);
kfree
(
htable_ops_in_progress
);
...
...
This diff is collapsed.
Click to expand it.
fs/orangefs/orangefs-sysfs.c
+
44
−
45
View file @
2180c52c
...
@@ -1611,27 +1611,22 @@ static struct stats_orangefs_obj *stats_orangefs_obj;
...
@@ -1611,27 +1611,22 @@ static struct stats_orangefs_obj *stats_orangefs_obj;
int
orangefs_sysfs_init
(
void
)
int
orangefs_sysfs_init
(
void
)
{
{
int
rc
;
int
rc
=
-
EINVAL
;
gossip_debug
(
GOSSIP_SYSFS_DEBUG
,
"orangefs_sysfs_init: start
\n
"
);
gossip_debug
(
GOSSIP_SYSFS_DEBUG
,
"orangefs_sysfs_init: start
\n
"
);
/* create /sys/fs/orangefs. */
/* create /sys/fs/orangefs. */
orangefs_obj
=
kzalloc
(
sizeof
(
*
orangefs_obj
),
GFP_KERNEL
);
orangefs_obj
=
kzalloc
(
sizeof
(
*
orangefs_obj
),
GFP_KERNEL
);
if
(
!
orangefs_obj
)
{
if
(
!
orangefs_obj
)
rc
=
-
EINVAL
;
goto
out
;
goto
out
;
}
rc
=
kobject_init_and_add
(
&
orangefs_obj
->
kobj
,
rc
=
kobject_init_and_add
(
&
orangefs_obj
->
kobj
,
&
orangefs_ktype
,
&
orangefs_ktype
,
fs_kobj
,
fs_kobj
,
ORANGEFS_KOBJ_ID
);
ORANGEFS_KOBJ_ID
);
if
(
rc
)
{
if
(
rc
)
kobject_put
(
&
orangefs_obj
->
kobj
);
goto
ofs_obj_bail
;
rc
=
-
EINVAL
;
goto
out
;
}
kobject_uevent
(
&
orangefs_obj
->
kobj
,
KOBJ_ADD
);
kobject_uevent
(
&
orangefs_obj
->
kobj
,
KOBJ_ADD
);
...
@@ -1639,7 +1634,7 @@ int orangefs_sysfs_init(void)
...
@@ -1639,7 +1634,7 @@ int orangefs_sysfs_init(void)
acache_orangefs_obj
=
kzalloc
(
sizeof
(
*
acache_orangefs_obj
),
GFP_KERNEL
);
acache_orangefs_obj
=
kzalloc
(
sizeof
(
*
acache_orangefs_obj
),
GFP_KERNEL
);
if
(
!
acache_orangefs_obj
)
{
if
(
!
acache_orangefs_obj
)
{
rc
=
-
EINVAL
;
rc
=
-
EINVAL
;
goto
o
ut
;
goto
o
fs_obj_bail
;
}
}
rc
=
kobject_init_and_add
(
&
acache_orangefs_obj
->
kobj
,
rc
=
kobject_init_and_add
(
&
acache_orangefs_obj
->
kobj
,
...
@@ -1647,11 +1642,8 @@ int orangefs_sysfs_init(void)
...
@@ -1647,11 +1642,8 @@ int orangefs_sysfs_init(void)
&
orangefs_obj
->
kobj
,
&
orangefs_obj
->
kobj
,
ACACHE_KOBJ_ID
);
ACACHE_KOBJ_ID
);
if
(
rc
)
{
if
(
rc
)
kobject_put
(
&
acache_orangefs_obj
->
kobj
);
goto
acache_obj_bail
;
rc
=
-
EINVAL
;
goto
out
;
}
kobject_uevent
(
&
acache_orangefs_obj
->
kobj
,
KOBJ_ADD
);
kobject_uevent
(
&
acache_orangefs_obj
->
kobj
,
KOBJ_ADD
);
...
@@ -1660,18 +1652,15 @@ int orangefs_sysfs_init(void)
...
@@ -1660,18 +1652,15 @@ int orangefs_sysfs_init(void)
kzalloc
(
sizeof
(
*
capcache_orangefs_obj
),
GFP_KERNEL
);
kzalloc
(
sizeof
(
*
capcache_orangefs_obj
),
GFP_KERNEL
);
if
(
!
capcache_orangefs_obj
)
{
if
(
!
capcache_orangefs_obj
)
{
rc
=
-
EINVAL
;
rc
=
-
EINVAL
;
goto
out
;
goto
acache_obj_bail
;
}
}
rc
=
kobject_init_and_add
(
&
capcache_orangefs_obj
->
kobj
,
rc
=
kobject_init_and_add
(
&
capcache_orangefs_obj
->
kobj
,
&
capcache_orangefs_ktype
,
&
capcache_orangefs_ktype
,
&
orangefs_obj
->
kobj
,
&
orangefs_obj
->
kobj
,
CAPCACHE_KOBJ_ID
);
CAPCACHE_KOBJ_ID
);
if
(
rc
)
{
if
(
rc
)
kobject_put
(
&
capcache_orangefs_obj
->
kobj
);
goto
capcache_obj_bail
;
rc
=
-
EINVAL
;
goto
out
;
}
kobject_uevent
(
&
capcache_orangefs_obj
->
kobj
,
KOBJ_ADD
);
kobject_uevent
(
&
capcache_orangefs_obj
->
kobj
,
KOBJ_ADD
);
...
@@ -1680,18 +1669,15 @@ int orangefs_sysfs_init(void)
...
@@ -1680,18 +1669,15 @@ int orangefs_sysfs_init(void)
kzalloc
(
sizeof
(
*
ccache_orangefs_obj
),
GFP_KERNEL
);
kzalloc
(
sizeof
(
*
ccache_orangefs_obj
),
GFP_KERNEL
);
if
(
!
ccache_orangefs_obj
)
{
if
(
!
ccache_orangefs_obj
)
{
rc
=
-
EINVAL
;
rc
=
-
EINVAL
;
goto
out
;
goto
capcache_obj_bail
;
}
}
rc
=
kobject_init_and_add
(
&
ccache_orangefs_obj
->
kobj
,
rc
=
kobject_init_and_add
(
&
ccache_orangefs_obj
->
kobj
,
&
ccache_orangefs_ktype
,
&
ccache_orangefs_ktype
,
&
orangefs_obj
->
kobj
,
&
orangefs_obj
->
kobj
,
CCACHE_KOBJ_ID
);
CCACHE_KOBJ_ID
);
if
(
rc
)
{
if
(
rc
)
kobject_put
(
&
ccache_orangefs_obj
->
kobj
);
goto
ccache_obj_bail
;
rc
=
-
EINVAL
;
goto
out
;
}
kobject_uevent
(
&
ccache_orangefs_obj
->
kobj
,
KOBJ_ADD
);
kobject_uevent
(
&
ccache_orangefs_obj
->
kobj
,
KOBJ_ADD
);
...
@@ -1699,7 +1685,7 @@ int orangefs_sysfs_init(void)
...
@@ -1699,7 +1685,7 @@ int orangefs_sysfs_init(void)
ncache_orangefs_obj
=
kzalloc
(
sizeof
(
*
ncache_orangefs_obj
),
GFP_KERNEL
);
ncache_orangefs_obj
=
kzalloc
(
sizeof
(
*
ncache_orangefs_obj
),
GFP_KERNEL
);
if
(
!
ncache_orangefs_obj
)
{
if
(
!
ncache_orangefs_obj
)
{
rc
=
-
EINVAL
;
rc
=
-
EINVAL
;
goto
out
;
goto
ccache_obj_bail
;
}
}
rc
=
kobject_init_and_add
(
&
ncache_orangefs_obj
->
kobj
,
rc
=
kobject_init_and_add
(
&
ncache_orangefs_obj
->
kobj
,
...
@@ -1707,11 +1693,8 @@ int orangefs_sysfs_init(void)
...
@@ -1707,11 +1693,8 @@ int orangefs_sysfs_init(void)
&
orangefs_obj
->
kobj
,
&
orangefs_obj
->
kobj
,
NCACHE_KOBJ_ID
);
NCACHE_KOBJ_ID
);
if
(
rc
)
{
if
(
rc
)
kobject_put
(
&
ncache_orangefs_obj
->
kobj
);
goto
ncache_obj_bail
;
rc
=
-
EINVAL
;
goto
out
;
}
kobject_uevent
(
&
ncache_orangefs_obj
->
kobj
,
KOBJ_ADD
);
kobject_uevent
(
&
ncache_orangefs_obj
->
kobj
,
KOBJ_ADD
);
...
@@ -1719,7 +1702,7 @@ int orangefs_sysfs_init(void)
...
@@ -1719,7 +1702,7 @@ int orangefs_sysfs_init(void)
pc_orangefs_obj
=
kzalloc
(
sizeof
(
*
pc_orangefs_obj
),
GFP_KERNEL
);
pc_orangefs_obj
=
kzalloc
(
sizeof
(
*
pc_orangefs_obj
),
GFP_KERNEL
);
if
(
!
pc_orangefs_obj
)
{
if
(
!
pc_orangefs_obj
)
{
rc
=
-
EINVAL
;
rc
=
-
EINVAL
;
goto
out
;
goto
ncache_obj_bail
;
}
}
rc
=
kobject_init_and_add
(
&
pc_orangefs_obj
->
kobj
,
rc
=
kobject_init_and_add
(
&
pc_orangefs_obj
->
kobj
,
...
@@ -1727,11 +1710,8 @@ int orangefs_sysfs_init(void)
...
@@ -1727,11 +1710,8 @@ int orangefs_sysfs_init(void)
&
orangefs_obj
->
kobj
,
&
orangefs_obj
->
kobj
,
"perf_counters"
);
"perf_counters"
);
if
(
rc
)
{
if
(
rc
)
kobject_put
(
&
pc_orangefs_obj
->
kobj
);
goto
pc_obj_bail
;
rc
=
-
EINVAL
;
goto
out
;
}
kobject_uevent
(
&
pc_orangefs_obj
->
kobj
,
KOBJ_ADD
);
kobject_uevent
(
&
pc_orangefs_obj
->
kobj
,
KOBJ_ADD
);
...
@@ -1739,7 +1719,7 @@ int orangefs_sysfs_init(void)
...
@@ -1739,7 +1719,7 @@ int orangefs_sysfs_init(void)
stats_orangefs_obj
=
kzalloc
(
sizeof
(
*
stats_orangefs_obj
),
GFP_KERNEL
);
stats_orangefs_obj
=
kzalloc
(
sizeof
(
*
stats_orangefs_obj
),
GFP_KERNEL
);
if
(
!
stats_orangefs_obj
)
{
if
(
!
stats_orangefs_obj
)
{
rc
=
-
EINVAL
;
rc
=
-
EINVAL
;
goto
out
;
goto
pc_obj_bail
;
}
}
rc
=
kobject_init_and_add
(
&
stats_orangefs_obj
->
kobj
,
rc
=
kobject_init_and_add
(
&
stats_orangefs_obj
->
kobj
,
...
@@ -1747,13 +1727,32 @@ int orangefs_sysfs_init(void)
...
@@ -1747,13 +1727,32 @@ int orangefs_sysfs_init(void)
&
orangefs_obj
->
kobj
,
&
orangefs_obj
->
kobj
,
STATS_KOBJ_ID
);
STATS_KOBJ_ID
);
if
(
rc
)
{
if
(
rc
)
kobject_put
(
&
stats_orangefs_obj
->
kobj
);
goto
stats_obj_bail
;
rc
=
-
EINVAL
;
goto
out
;
}
kobject_uevent
(
&
stats_orangefs_obj
->
kobj
,
KOBJ_ADD
);
kobject_uevent
(
&
stats_orangefs_obj
->
kobj
,
KOBJ_ADD
);
goto
out
;
stats_obj_bail:
kobject_put
(
&
stats_orangefs_obj
->
kobj
);
pc_obj_bail:
kobject_put
(
&
pc_orangefs_obj
->
kobj
);
ncache_obj_bail:
kobject_put
(
&
ncache_orangefs_obj
->
kobj
);
ccache_obj_bail:
kobject_put
(
&
ccache_orangefs_obj
->
kobj
);
capcache_obj_bail:
kobject_put
(
&
capcache_orangefs_obj
->
kobj
);
acache_obj_bail:
kobject_put
(
&
acache_orangefs_obj
->
kobj
);
ofs_obj_bail:
kobject_put
(
&
orangefs_obj
->
kobj
);
out:
out:
return
rc
;
return
rc
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment