Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
51feb8db
Unverified
Commit
51feb8db
authored
Feb 17, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: use non-flag based checking now that we switched all codepaths over
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
9394b6dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
cgfsng.c
src/lxc/cgroups/cgfsng.c
+23
-7
No files found.
src/lxc/cgroups/cgfsng.c
View file @
51feb8db
...
...
@@ -1772,7 +1772,16 @@ __cgfsng_ops static void cgfsng_payload_finalize(struct cgroup_ops *ops)
/* cgroup-full:* is done, no need to create subdirs */
static
inline
bool
cg_mount_needs_subdirs
(
int
cg_flags
)
{
return
!
(
cg_flags
>=
LXC_AUTO_CGROUP_FULL_RO
);
switch
(
cg_flags
)
{
case
LXC_AUTO_CGROUP_RO
:
return
true
;
case
LXC_AUTO_CGROUP_RW
:
return
true
;
case
LXC_AUTO_CGROUP_MIXED
:
return
true
;
}
return
false
;
}
/* After $rootfs/sys/fs/container/controller/the/cg/path has been created,
...
...
@@ -1787,7 +1796,7 @@ static int cg_legacy_mount_controllers(int cg_flags, struct hierarchy *h,
int
ret
,
remount_flags
;
int
flags
=
MS_BIND
;
if
((
cg_flags
&
LXC_AUTO_CGROUP_RO
)
||
(
cg_flags
&
LXC_AUTO_CGROUP_MIXED
))
{
if
((
cg_flags
==
LXC_AUTO_CGROUP_RO
)
||
(
cg_flags
==
LXC_AUTO_CGROUP_MIXED
))
{
ret
=
mount
(
controllerpath
,
controllerpath
,
"cgroup"
,
MS_BIND
,
NULL
);
if
(
ret
<
0
)
return
log_error_errno
(
-
1
,
errno
,
"Failed to bind mount
\"
%s
\"
onto
\"
%s
\"
"
,
...
...
@@ -1807,7 +1816,7 @@ static int cg_legacy_mount_controllers(int cg_flags, struct hierarchy *h,
sourcepath
=
must_make_path
(
h
->
mountpoint
,
h
->
container_base_path
,
container_cgroup
,
NULL
);
if
(
(
cg_flags
&
LXC_AUTO_CGROUP_RO
)
)
if
(
cg_flags
==
LXC_AUTO_CGROUP_RO
)
flags
|=
MS_RDONLY
;
ret
=
mount
(
sourcepath
,
cgpath
,
"cgroup"
,
flags
,
NULL
);
...
...
@@ -1852,8 +1861,8 @@ static int __cgroupfs_mount(int cg_flags, struct hierarchy *h,
flags
|=
MOUNT_ATTR_NODEV
;
flags
|=
MOUNT_ATTR_RELATIME
;
if
((
cg_flags
&
LXC_AUTO_CGROUP_RO
)
||
(
cg_flags
&
LXC_AUTO_CGROUP_FULL_RO
))
if
((
cg_flags
==
LXC_AUTO_CGROUP_RO
)
||
(
cg_flags
==
LXC_AUTO_CGROUP_FULL_RO
))
flags
|=
MOUNT_ATTR_RDONLY
;
if
(
is_unified_hierarchy
(
h
))
{
...
...
@@ -1921,9 +1930,16 @@ static inline int cgroupfs_bind_mount(int cg_flags, struct hierarchy *h,
int
dfd_mnt_cgroupfs
,
const
char
*
hierarchy_mnt
)
{
if
(
!
(
cg_flags
&
LXC_AUTO_CGROUP_FULL_RO
)
&&
!
(
cg_flags
&
LXC_AUTO_CGROUP_FULL_MIXED
))
switch
(
cg_flags
)
{
case
LXC_AUTO_CGROUP_FULL_RO
:
break
;
case
LXC_AUTO_CGROUP_FULL_RW
:
break
;
case
LXC_AUTO_CGROUP_FULL_MIXED
:
break
;
default:
return
0
;
}
return
__cgroupfs_mount
(
cg_flags
,
h
,
rootfs
,
dfd_mnt_cgroupfs
,
hierarchy_mnt
);
}
...
...
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