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
56cf2a57
Unverified
Commit
56cf2a57
authored
Dec 12, 2019
by
Stéphane Graber
Committed by
GitHub
Dec 12, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3229 from brauner/2019-12-12/cgroup_legacy_layout_regression
cgroups/cgfsng: do not prematurely close file descriptors
parents
28a41fc2
78eb6aa6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
11 deletions
+28
-11
cgfsng.c
src/lxc/cgroups/cgfsng.c
+24
-11
cgroup.h
src/lxc/cgroups/cgroup.h
+1
-0
start.c
src/lxc/start.c
+3
-0
No files found.
src/lxc/cgroups/cgfsng.c
View file @
56cf2a57
...
...
@@ -1413,9 +1413,9 @@ __cgfsng_ops static bool cgfsng_monitor_enter(struct cgroup_ops *ops,
return
log_error_errno
(
false
,
errno
,
"Failed to enter cgroup
\"
%s
\"
"
,
h
->
monitor_full_path
);
/*
*
W
e don't keep the fds for non-unified hierarchies around
*
w
e don't keep the fds for non-unified hierarchies around
* mainly because we don't make use of them anymore after the
* core cgroup setup is done but also because the
y'
re quite a
* core cgroup setup is done but also because the
re a
re quite a
* lot of them.
*/
if
(
!
is_unified_hierarchy
(
h
))
...
...
@@ -1453,15 +1453,6 @@ __cgfsng_ops static bool cgfsng_payload_enter(struct cgroup_ops *ops,
ret
=
lxc_writeat
(
h
->
cgfd_con
,
"cgroup.procs"
,
pidstr
,
len
);
if
(
ret
!=
0
)
return
log_error_errno
(
false
,
errno
,
"Failed to enter cgroup
\"
%s
\"
"
,
h
->
container_full_path
);
/*
* We don't keep the fds for non-unified hierarchies around
* mainly because we don't make use of them anymore after the
* core cgroup setup is done but also because they're quite a
* lot of them.
*/
if
(
!
is_unified_hierarchy
(
h
))
close_prot_errno_disarm
(
h
->
cgfd_con
);
}
return
true
;
...
...
@@ -1582,6 +1573,27 @@ __cgfsng_ops static bool cgfsng_chown(struct cgroup_ops *ops,
return
true
;
}
__cgfsng_ops
void
cgfsng_payload_finalize
(
struct
cgroup_ops
*
ops
)
{
if
(
!
ops
)
return
;
if
(
!
ops
->
hierarchies
)
return
;
for
(
int
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
struct
hierarchy
*
h
=
ops
->
hierarchies
[
i
];
/*
* we don't keep the fds for non-unified hierarchies around
* mainly because we don't make use of them anymore after the
* core cgroup setup is done but also because there are quite a
* lot of them.
*/
if
(
!
is_unified_hierarchy
(
h
))
close_prot_errno_disarm
(
h
->
cgfd_con
);
}
}
/* cgroup-full:* is done, no need to create subdirs */
static
bool
cg_mount_needs_subdirs
(
int
type
)
{
...
...
@@ -3253,6 +3265,7 @@ struct cgroup_ops *cgfsng_ops_init(struct lxc_conf *conf)
cgfsng_ops
->
payload_delegate_controllers
=
cgfsng_payload_delegate_controllers
;
cgfsng_ops
->
payload_create
=
cgfsng_payload_create
;
cgfsng_ops
->
payload_enter
=
cgfsng_payload_enter
;
cgfsng_ops
->
payload_finalize
=
cgfsng_payload_finalize
;
cgfsng_ops
->
escape
=
cgfsng_escape
;
cgfsng_ops
->
num_hierarchies
=
cgfsng_num_hierarchies
;
cgfsng_ops
->
get_hierarchies
=
cgfsng_get_hierarchies
;
...
...
src/lxc/cgroups/cgroup.h
View file @
56cf2a57
...
...
@@ -166,6 +166,7 @@ struct cgroup_ops {
struct
lxc_handler
*
handler
);
bool
(
*
monitor_delegate_controllers
)(
struct
cgroup_ops
*
ops
);
bool
(
*
payload_delegate_controllers
)(
struct
cgroup_ops
*
ops
);
void
(
*
payload_finalize
)(
struct
cgroup_ops
*
ops
);
};
extern
struct
cgroup_ops
*
cgroup_init
(
struct
lxc_conf
*
conf
);
...
...
src/lxc/start.c
View file @
56cf2a57
...
...
@@ -1922,6 +1922,9 @@ static int lxc_spawn(struct lxc_handler *handler)
}
}
cgroup_ops
->
payload_finalize
(
cgroup_ops
);
TRACE
(
"Finished setting up cgroups"
);
/* Run any host-side start hooks */
ret
=
run_lxc_hooks
(
name
,
"start-host"
,
conf
,
NULL
);
if
(
ret
<
0
)
{
...
...
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