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
888aad37
Unverified
Commit
888aad37
authored
Jan 10, 2019
by
Wolfgang Bumiller
Committed by
GitHub
Jan 10, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2777 from brauner/2019-01-09/cgfsng_with_no_controllers
cgroups: try to handle layouts with no cgroups
parents
2fa5dff9
69b4a4bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
3 deletions
+33
-3
cgfsng.c
src/lxc/cgroups/cgfsng.c
+33
-3
No files found.
src/lxc/cgroups/cgfsng.c
View file @
888aad37
...
@@ -1108,6 +1108,9 @@ __cgfsng_ops static void cgfsng_payload_destroy(struct cgroup_ops *ops,
...
@@ -1108,6 +1108,9 @@ __cgfsng_ops static void cgfsng_payload_destroy(struct cgroup_ops *ops,
int
ret
;
int
ret
;
struct
generic_userns_exec_data
wrap
;
struct
generic_userns_exec_data
wrap
;
if
(
!
ops
->
hierarchies
)
return
;
wrap
.
origuid
=
0
;
wrap
.
origuid
=
0
;
wrap
.
container_cgroup
=
ops
->
container_cgroup
;
wrap
.
container_cgroup
=
ops
->
container_cgroup
;
wrap
.
hierarchies
=
ops
->
hierarchies
;
wrap
.
hierarchies
=
ops
->
hierarchies
;
...
@@ -1376,6 +1379,9 @@ __cgfsng_ops static inline bool cgfsng_monitor_create(struct cgroup_ops *ops,
...
@@ -1376,6 +1379,9 @@ __cgfsng_ops static inline bool cgfsng_monitor_create(struct cgroup_ops *ops,
if
(
!
conf
)
if
(
!
conf
)
return
bret
;
return
bret
;
if
(
!
ops
->
hierarchies
)
return
true
;
if
(
conf
->
cgroup_meta
.
dir
)
if
(
conf
->
cgroup_meta
.
dir
)
tmp
=
lxc_string_join
(
"/"
,
tmp
=
lxc_string_join
(
"/"
,
(
const
char
*
[]){
conf
->
cgroup_meta
.
dir
,
(
const
char
*
[]){
conf
->
cgroup_meta
.
dir
,
...
@@ -1442,6 +1448,9 @@ __cgfsng_ops static inline bool cgfsng_payload_create(struct cgroup_ops *ops,
...
@@ -1442,6 +1448,9 @@ __cgfsng_ops static inline bool cgfsng_payload_create(struct cgroup_ops *ops,
if
(
!
conf
)
if
(
!
conf
)
return
false
;
return
false
;
if
(
!
ops
->
hierarchies
)
return
true
;
if
(
conf
->
cgroup_meta
.
dir
)
if
(
conf
->
cgroup_meta
.
dir
)
tmp
=
lxc_string_join
(
"/"
,
(
const
char
*
[]){
conf
->
cgroup_meta
.
dir
,
handler
->
name
,
NULL
},
false
);
tmp
=
lxc_string_join
(
"/"
,
(
const
char
*
[]){
conf
->
cgroup_meta
.
dir
,
handler
->
name
,
NULL
},
false
);
else
else
...
@@ -1505,6 +1514,9 @@ __cgfsng_ops static bool __do_cgroup_enter(struct cgroup_ops *ops, pid_t pid,
...
@@ -1505,6 +1514,9 @@ __cgfsng_ops static bool __do_cgroup_enter(struct cgroup_ops *ops, pid_t pid,
int
len
;
int
len
;
char
pidstr
[
INTTYPE_TO_STRLEN
(
pid_t
)];
char
pidstr
[
INTTYPE_TO_STRLEN
(
pid_t
)];
if
(
!
ops
->
hierarchies
)
return
true
;
len
=
snprintf
(
pidstr
,
sizeof
(
pidstr
),
"%d"
,
pid
);
len
=
snprintf
(
pidstr
,
sizeof
(
pidstr
),
"%d"
,
pid
);
if
(
len
<
0
||
(
size_t
)
len
>=
sizeof
(
pidstr
))
if
(
len
<
0
||
(
size_t
)
len
>=
sizeof
(
pidstr
))
return
false
;
return
false
;
...
@@ -1648,6 +1660,9 @@ __cgfsng_ops static bool cgfsng_chown(struct cgroup_ops *ops,
...
@@ -1648,6 +1660,9 @@ __cgfsng_ops static bool cgfsng_chown(struct cgroup_ops *ops,
if
(
lxc_list_empty
(
&
conf
->
id_map
))
if
(
lxc_list_empty
(
&
conf
->
id_map
))
return
true
;
return
true
;
if
(
!
ops
->
hierarchies
)
return
true
;
wrap
.
origuid
=
geteuid
();
wrap
.
origuid
=
geteuid
();
wrap
.
path
=
NULL
;
wrap
.
path
=
NULL
;
wrap
.
hierarchies
=
ops
->
hierarchies
;
wrap
.
hierarchies
=
ops
->
hierarchies
;
...
@@ -1798,6 +1813,9 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
...
@@ -1798,6 +1813,9 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
char
*
tmpfspath
=
NULL
;
char
*
tmpfspath
=
NULL
;
bool
has_cgns
=
false
,
retval
=
false
,
wants_force_mount
=
false
;
bool
has_cgns
=
false
,
retval
=
false
,
wants_force_mount
=
false
;
if
(
!
ops
->
hierarchies
)
return
true
;
if
((
type
&
LXC_AUTO_CGROUP_MASK
)
==
0
)
if
((
type
&
LXC_AUTO_CGROUP_MASK
)
==
0
)
return
true
;
return
true
;
...
@@ -1961,7 +1979,7 @@ __cgfsng_ops static bool cgfsng_escape(const struct cgroup_ops *ops,
...
@@ -1961,7 +1979,7 @@ __cgfsng_ops static bool cgfsng_escape(const struct cgroup_ops *ops,
{
{
int
i
;
int
i
;
if
(
conf
->
cgroup_meta
.
relative
||
geteuid
())
if
(
conf
->
cgroup_meta
.
relative
||
geteuid
()
||
!
ops
->
hierarchies
)
return
true
;
return
true
;
for
(
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
for
(
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
...
@@ -1985,9 +2003,12 @@ __cgfsng_ops static bool cgfsng_escape(const struct cgroup_ops *ops,
...
@@ -1985,9 +2003,12 @@ __cgfsng_ops static bool cgfsng_escape(const struct cgroup_ops *ops,
__cgfsng_ops
static
int
cgfsng_num_hierarchies
(
struct
cgroup_ops
*
ops
)
__cgfsng_ops
static
int
cgfsng_num_hierarchies
(
struct
cgroup_ops
*
ops
)
{
{
int
i
;
int
i
=
0
;
if
(
!
ops
->
hierarchies
)
return
0
;
for
(
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
for
(;
ops
->
hierarchies
[
i
];
i
++
)
;
;
return
i
;
return
i
;
...
@@ -1997,6 +2018,9 @@ __cgfsng_ops static bool cgfsng_get_hierarchies(struct cgroup_ops *ops, int n, c
...
@@ -1997,6 +2018,9 @@ __cgfsng_ops static bool cgfsng_get_hierarchies(struct cgroup_ops *ops, int n, c
{
{
int
i
;
int
i
;
if
(
!
ops
->
hierarchies
)
return
false
;
/* sanity check n */
/* sanity check n */
for
(
i
=
0
;
i
<
n
;
i
++
)
for
(
i
=
0
;
i
<
n
;
i
++
)
if
(
!
ops
->
hierarchies
[
i
])
if
(
!
ops
->
hierarchies
[
i
])
...
@@ -2138,6 +2162,9 @@ __cgfsng_ops static bool cgfsng_attach(struct cgroup_ops *ops, const char *name,
...
@@ -2138,6 +2162,9 @@ __cgfsng_ops static bool cgfsng_attach(struct cgroup_ops *ops, const char *name,
int
i
,
len
,
ret
;
int
i
,
len
,
ret
;
char
pidstr
[
INTTYPE_TO_STRLEN
(
pid_t
)];
char
pidstr
[
INTTYPE_TO_STRLEN
(
pid_t
)];
if
(
!
ops
->
hierarchies
)
return
true
;
len
=
snprintf
(
pidstr
,
sizeof
(
pidstr
),
"%d"
,
pid
);
len
=
snprintf
(
pidstr
,
sizeof
(
pidstr
),
"%d"
,
pid
);
if
(
len
<
0
||
(
size_t
)
len
>=
sizeof
(
pidstr
))
if
(
len
<
0
||
(
size_t
)
len
>=
sizeof
(
pidstr
))
return
false
;
return
false
;
...
@@ -2387,6 +2414,9 @@ static bool __cg_legacy_setup_limits(struct cgroup_ops *ops,
...
@@ -2387,6 +2414,9 @@ static bool __cg_legacy_setup_limits(struct cgroup_ops *ops,
if
(
lxc_list_empty
(
cgroup_settings
))
if
(
lxc_list_empty
(
cgroup_settings
))
return
true
;
return
true
;
if
(
!
ops
->
hierarchies
)
return
false
;
sorted_cgroup_settings
=
sort_cgroup_settings
(
cgroup_settings
);
sorted_cgroup_settings
=
sort_cgroup_settings
(
cgroup_settings
);
if
(
!
sorted_cgroup_settings
)
if
(
!
sorted_cgroup_settings
)
return
false
;
return
false
;
...
...
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