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
c581c8a3
Unverified
Commit
c581c8a3
authored
Feb 15, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: switch to flag-based checking
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
68599aab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
cgfsng.c
src/lxc/cgroups/cgfsng.c
+11
-5
No files found.
src/lxc/cgroups/cgfsng.c
View file @
c581c8a3
...
@@ -1791,7 +1791,8 @@ static int __cg_mount_direct(int cg_flags, struct hierarchy *h,
...
@@ -1791,7 +1791,8 @@ static int __cg_mount_direct(int cg_flags, struct hierarchy *h,
flags
|=
MOUNT_ATTR_NODEV
;
flags
|=
MOUNT_ATTR_NODEV
;
flags
|=
MOUNT_ATTR_RELATIME
;
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
;
flags
|=
MOUNT_ATTR_RDONLY
;
if
(
is_unified_hierarchy
(
h
))
{
if
(
is_unified_hierarchy
(
h
))
{
...
@@ -1860,7 +1861,8 @@ static inline int cg_mount_cgroup_full(int cg_flags, struct hierarchy *h,
...
@@ -1860,7 +1861,8 @@ static inline int cg_mount_cgroup_full(int cg_flags, struct hierarchy *h,
int
dfd_mnt_cgroupfs
,
int
dfd_mnt_cgroupfs
,
const
char
*
hierarchy_mnt
)
const
char
*
hierarchy_mnt
)
{
{
if
(
cg_flags
<
LXC_AUTO_CGROUP_FULL_RO
||
cg_flags
>
LXC_AUTO_CGROUP_FULL_MIXED
)
if
(
!
(
cg_flags
&
LXC_AUTO_CGROUP_FULL_RO
)
&&
!
(
cg_flags
&
LXC_AUTO_CGROUP_FULL_MIXED
))
return
0
;
return
0
;
return
__cg_mount_direct
(
cg_flags
,
h
,
rootfs
,
dfd_mnt_cgroupfs
,
hierarchy_mnt
);
return
__cg_mount_direct
(
cg_flags
,
h
,
rootfs
,
dfd_mnt_cgroupfs
,
hierarchy_mnt
);
...
@@ -1887,7 +1889,7 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
...
@@ -1887,7 +1889,7 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
return
ret_set_errno
(
false
,
EINVAL
);
return
ret_set_errno
(
false
,
EINVAL
);
if
((
cg_flags
&
LXC_AUTO_CGROUP_MASK
)
==
0
)
if
((
cg_flags
&
LXC_AUTO_CGROUP_MASK
)
==
0
)
return
true
;
return
log_trace
(
true
,
"No cgroup mounts requested"
)
;
if
(
cg_flags
&
LXC_AUTO_CGROUP_FORCE
)
if
(
cg_flags
&
LXC_AUTO_CGROUP_FORCE
)
wants_force_mount
=
true
;
wants_force_mount
=
true
;
...
@@ -1914,9 +1916,13 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
...
@@ -1914,9 +1916,13 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
if
(
in_cgroup_ns
&&
!
wants_force_mount
)
if
(
in_cgroup_ns
&&
!
wants_force_mount
)
return
true
;
return
true
;
if
(
cg_flags
==
LXC_AUTO_CGROUP_NOSPEC
)
/*
* Fallback to a mixed layout when the user did not specify what cgroup
* layout they want.
*/
if
((
cg_flags
&
LXC_AUTO_CGROUP_NOSPEC
))
cg_flags
=
LXC_AUTO_CGROUP_MIXED
;
cg_flags
=
LXC_AUTO_CGROUP_MIXED
;
else
if
(
cg_flags
==
LXC_AUTO_CGROUP_FULL_NOSPEC
)
else
if
(
cg_flags
&
LXC_AUTO_CGROUP_FULL_NOSPEC
)
cg_flags
=
LXC_AUTO_CGROUP_FULL_MIXED
;
cg_flags
=
LXC_AUTO_CGROUP_FULL_MIXED
;
/* This is really the codepath that we want. */
/* This is really the codepath that we want. */
...
...
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