Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
7feeef58
Commit
7feeef58
authored
Jan 16, 2019
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroup: fold cgroup1_mount() into cgroup1_get_tree()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
90129625
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
31 deletions
+18
-31
kernel/cgroup/cgroup-internal.h
kernel/cgroup/cgroup-internal.h
+1
-3
kernel/cgroup/cgroup-v1.c
kernel/cgroup/cgroup-v1.c
+17
-9
kernel/cgroup/cgroup.c
kernel/cgroup/cgroup.c
+0
-19
No files found.
kernel/cgroup/cgroup-internal.h
View file @
7feeef58
...
@@ -265,9 +265,7 @@ bool cgroup1_ssid_disabled(int ssid);
...
@@ -265,9 +265,7 @@ bool cgroup1_ssid_disabled(int ssid);
void
cgroup1_pidlist_destroy_all
(
struct
cgroup
*
cgrp
);
void
cgroup1_pidlist_destroy_all
(
struct
cgroup
*
cgrp
);
void
cgroup1_release_agent
(
struct
work_struct
*
work
);
void
cgroup1_release_agent
(
struct
work_struct
*
work
);
void
cgroup1_check_for_release
(
struct
cgroup
*
cgrp
);
void
cgroup1_check_for_release
(
struct
cgroup
*
cgrp
);
struct
dentry
*
cgroup1_mount
(
struct
file_system_type
*
fs_type
,
int
flags
,
int
cgroup1_get_tree
(
struct
fs_context
*
fc
);
void
*
data
,
unsigned
long
magic
,
struct
cgroup_namespace
*
ns
);
int
cgroup1_reconfigure
(
struct
fs_context
*
ctx
);
int
cgroup1_reconfigure
(
struct
fs_context
*
ctx
);
#endif
/* __CGROUP_INTERNAL_H */
#endif
/* __CGROUP_INTERNAL_H */
kernel/cgroup/cgroup-v1.c
View file @
7feeef58
...
@@ -1113,20 +1113,24 @@ struct kernfs_syscall_ops cgroup1_kf_syscall_ops = {
...
@@ -1113,20 +1113,24 @@ struct kernfs_syscall_ops cgroup1_kf_syscall_ops = {
.
show_path
=
cgroup_show_path
,
.
show_path
=
cgroup_show_path
,
};
};
struct
dentry
*
cgroup1_mount
(
struct
file_system_type
*
fs_type
,
int
flags
,
int
cgroup1_get_tree
(
struct
fs_context
*
fc
)
void
*
data
,
unsigned
long
magic
,
struct
cgroup_namespace
*
ns
)
{
{
struct
cgroup_namespace
*
ns
=
current
->
nsproxy
->
cgroup_ns
;
struct
cgroup_fs_context
*
ctx
=
cgroup_fc2context
(
fc
);
struct
cgroup_sb_opts
opts
;
struct
cgroup_sb_opts
opts
;
struct
cgroup_root
*
root
;
struct
cgroup_root
*
root
;
struct
cgroup_subsys
*
ss
;
struct
cgroup_subsys
*
ss
;
struct
dentry
*
dentry
;
struct
dentry
*
dentry
;
int
i
,
ret
;
int
i
,
ret
;
/* Check if the caller has permission to mount. */
if
(
!
ns_capable
(
ns
->
user_ns
,
CAP_SYS_ADMIN
))
return
-
EPERM
;
cgroup_lock_and_drain_offline
(
&
cgrp_dfl_root
.
cgrp
);
cgroup_lock_and_drain_offline
(
&
cgrp_dfl_root
.
cgrp
);
/* First find the desired set of subsystems */
/* First find the desired set of subsystems */
ret
=
parse_cgroupfs_options
(
data
,
&
opts
);
ret
=
parse_cgroupfs_options
(
ctx
->
data
,
&
opts
);
if
(
ret
)
if
(
ret
)
goto
out_unlock
;
goto
out_unlock
;
...
@@ -1228,19 +1232,23 @@ struct dentry *cgroup1_mount(struct file_system_type *fs_type, int flags,
...
@@ -1228,19 +1232,23 @@ struct dentry *cgroup1_mount(struct file_system_type *fs_type, int flags,
kfree
(
opts
.
name
);
kfree
(
opts
.
name
);
if
(
ret
)
if
(
ret
)
return
ERR_PTR
(
ret
)
;
return
ret
;
dentry
=
cgroup_do_mount
(
&
cgroup_fs_type
,
flags
,
root
,
dentry
=
cgroup_do_mount
(
&
cgroup_fs_type
,
f
c
->
sb_f
lags
,
root
,
CGROUP_SUPER_MAGIC
,
ns
);
CGROUP_SUPER_MAGIC
,
ns
);
if
(
IS_ERR
(
dentry
))
return
PTR_ERR
(
dentry
);
if
(
!
IS_ERR
(
dentry
)
&&
percpu_ref_is_dying
(
&
root
->
cgrp
.
self
.
refcnt
))
{
if
(
percpu_ref_is_dying
(
&
root
->
cgrp
.
self
.
refcnt
))
{
struct
super_block
*
sb
=
dentry
->
d_sb
;
struct
super_block
*
sb
=
dentry
->
d_sb
;
dput
(
dentry
);
dput
(
dentry
);
deactivate_locked_super
(
sb
);
deactivate_locked_super
(
sb
);
msleep
(
10
);
msleep
(
10
);
dentry
=
ERR_PTR
(
restart_syscall
()
);
return
restart_syscall
(
);
}
}
return
dentry
;
fc
->
root
=
dentry
;
return
0
;
}
}
static
int
__init
cgroup1_wq_init
(
void
)
static
int
__init
cgroup1_wq_init
(
void
)
...
...
kernel/cgroup/cgroup.c
View file @
7feeef58
...
@@ -2117,25 +2117,6 @@ static int cgroup_get_tree(struct fs_context *fc)
...
@@ -2117,25 +2117,6 @@ static int cgroup_get_tree(struct fs_context *fc)
return
0
;
return
0
;
}
}
static
int
cgroup1_get_tree
(
struct
fs_context
*
fc
)
{
struct
cgroup_namespace
*
ns
=
current
->
nsproxy
->
cgroup_ns
;
struct
cgroup_fs_context
*
ctx
=
cgroup_fc2context
(
fc
);
struct
dentry
*
root
;
/* Check if the caller has permission to mount. */
if
(
!
ns_capable
(
ns
->
user_ns
,
CAP_SYS_ADMIN
))
return
-
EPERM
;
root
=
cgroup1_mount
(
&
cgroup_fs_type
,
fc
->
sb_flags
,
ctx
->
data
,
CGROUP_SUPER_MAGIC
,
ns
);
if
(
IS_ERR
(
root
))
return
PTR_ERR
(
root
);
fc
->
root
=
root
;
return
0
;
}
static
const
struct
fs_context_operations
cgroup_fs_context_ops
=
{
static
const
struct
fs_context_operations
cgroup_fs_context_ops
=
{
.
free
=
cgroup_fs_context_free
,
.
free
=
cgroup_fs_context_free
,
.
parse_monolithic
=
cgroup_parse_monolithic
,
.
parse_monolithic
=
cgroup_parse_monolithic
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment