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
a093bb0f
Unverified
Commit
a093bb0f
authored
Oct 27, 2020
by
Christian Brauner
Committed by
GitHub
Oct 27, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3563 from Drachenfels-GmbH/cgroup-fixes
cgroups: Introduce lxc.cgroup.dir.monitor.pivot - fixes cgroup removal on termination
parents
5fd31e37
7696c1f9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
1 deletion
+53
-1
lxc.container.conf.sgml.in
doc/lxc.container.conf.sgml.in
+12
-0
cgfsng.c
src/lxc/cgroups/cgfsng.c
+4
-1
conf.h
src/lxc/conf.h
+1
-0
confile.c
src/lxc/confile.c
+36
-0
No files found.
doc/lxc.container.conf.sgml.in
View file @
a093bb0f
...
@@ -1606,6 +1606,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
...
@@ -1606,6 +1606,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</varlistentry>
</varlistentry>
<varlistentry>
<varlistentry>
<term>
<term>
<option>lxc.cgroup.dir.monitor.pivot</option>
</term>
<listitem>
<para>
On container termination the PID of the monitor process is attached to this cgroup.
This path should not be a subpath of any other configured cgroup dir to ensure
proper removal of other cgroup paths on container termination.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>lxc.cgroup.dir.container.inner</option>
<option>lxc.cgroup.dir.container.inner</option>
</term>
</term>
<listitem>
<listitem>
...
...
src/lxc/cgroups/cgfsng.c
View file @
a093bb0f
...
@@ -1093,7 +1093,10 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops,
...
@@ -1093,7 +1093,10 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops,
goto
try_lxc_rm_rf
;
goto
try_lxc_rm_rf
;
}
}
if
(
conf
&&
conf
->
cgroup_meta
.
monitor_dir
)
if
(
conf
&&
conf
->
cgroup_meta
.
monitor_pivot_dir
)
pivot_path
=
must_make_path
(
h
->
mountpoint
,
h
->
container_base_path
,
conf
->
cgroup_meta
.
monitor_pivot_dir
,
CGROUP_PIVOT
,
NULL
);
else
if
(
conf
&&
conf
->
cgroup_meta
.
monitor_dir
)
pivot_path
=
must_make_path
(
h
->
mountpoint
,
h
->
container_base_path
,
pivot_path
=
must_make_path
(
h
->
mountpoint
,
h
->
container_base_path
,
conf
->
cgroup_meta
.
monitor_dir
,
CGROUP_PIVOT
,
NULL
);
conf
->
cgroup_meta
.
monitor_dir
,
CGROUP_PIVOT
,
NULL
);
else
if
(
conf
&&
conf
->
cgroup_meta
.
dir
)
else
if
(
conf
&&
conf
->
cgroup_meta
.
dir
)
...
...
src/lxc/conf.h
View file @
a093bb0f
...
@@ -61,6 +61,7 @@ struct lxc_cgroup {
...
@@ -61,6 +61,7 @@ struct lxc_cgroup {
char
*
controllers
;
char
*
controllers
;
char
*
dir
;
char
*
dir
;
char
*
monitor_dir
;
char
*
monitor_dir
;
char
*
monitor_pivot_dir
;
char
*
container_dir
;
char
*
container_dir
;
char
*
namespace_dir
;
char
*
namespace_dir
;
bool
relative
;
bool
relative
;
...
...
src/lxc/confile.c
View file @
a093bb0f
...
@@ -73,6 +73,7 @@ lxc_config_define(cgroup_controller);
...
@@ -73,6 +73,7 @@ lxc_config_define(cgroup_controller);
lxc_config_define
(
cgroup2_controller
);
lxc_config_define
(
cgroup2_controller
);
lxc_config_define
(
cgroup_dir
);
lxc_config_define
(
cgroup_dir
);
lxc_config_define
(
cgroup_monitor_dir
);
lxc_config_define
(
cgroup_monitor_dir
);
lxc_config_define
(
cgroup_monitor_pivot_dir
);
lxc_config_define
(
cgroup_container_dir
);
lxc_config_define
(
cgroup_container_dir
);
lxc_config_define
(
cgroup_container_inner_dir
);
lxc_config_define
(
cgroup_container_inner_dir
);
lxc_config_define
(
cgroup_relative
);
lxc_config_define
(
cgroup_relative
);
...
@@ -178,6 +179,7 @@ static struct lxc_config_t config_jump_table[] = {
...
@@ -178,6 +179,7 @@ static struct lxc_config_t config_jump_table[] = {
{
"lxc.cap.drop"
,
set_config_cap_drop
,
get_config_cap_drop
,
clr_config_cap_drop
,
},
{
"lxc.cap.drop"
,
set_config_cap_drop
,
get_config_cap_drop
,
clr_config_cap_drop
,
},
{
"lxc.cap.keep"
,
set_config_cap_keep
,
get_config_cap_keep
,
clr_config_cap_keep
,
},
{
"lxc.cap.keep"
,
set_config_cap_keep
,
get_config_cap_keep
,
clr_config_cap_keep
,
},
{
"lxc.cgroup2"
,
set_config_cgroup2_controller
,
get_config_cgroup2_controller
,
clr_config_cgroup2_controller
,
},
{
"lxc.cgroup2"
,
set_config_cgroup2_controller
,
get_config_cgroup2_controller
,
clr_config_cgroup2_controller
,
},
{
"lxc.cgroup.dir.monitor.pivot"
,
set_config_cgroup_monitor_pivot_dir
,
get_config_cgroup_monitor_pivot_dir
,
clr_config_cgroup_monitor_pivot_dir
,
},
{
"lxc.cgroup.dir.monitor"
,
set_config_cgroup_monitor_dir
,
get_config_cgroup_monitor_dir
,
clr_config_cgroup_monitor_dir
,
},
{
"lxc.cgroup.dir.monitor"
,
set_config_cgroup_monitor_dir
,
get_config_cgroup_monitor_dir
,
clr_config_cgroup_monitor_dir
,
},
{
"lxc.cgroup.dir.container.inner"
,
set_config_cgroup_container_inner_dir
,
get_config_cgroup_container_inner_dir
,
clr_config_cgroup_container_inner_dir
,
},
{
"lxc.cgroup.dir.container.inner"
,
set_config_cgroup_container_inner_dir
,
get_config_cgroup_container_inner_dir
,
clr_config_cgroup_container_inner_dir
,
},
{
"lxc.cgroup.dir.container"
,
set_config_cgroup_container_dir
,
get_config_cgroup_container_dir
,
clr_config_cgroup_container_dir
,
},
{
"lxc.cgroup.dir.container"
,
set_config_cgroup_container_dir
,
get_config_cgroup_container_dir
,
clr_config_cgroup_container_dir
,
},
...
@@ -1826,6 +1828,16 @@ static int set_config_cgroup_monitor_dir(const char *key, const char *value,
...
@@ -1826,6 +1828,16 @@ static int set_config_cgroup_monitor_dir(const char *key, const char *value,
value
);
value
);
}
}
static
int
set_config_cgroup_monitor_pivot_dir
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
if
(
lxc_config_value_empty
(
value
))
return
clr_config_cgroup_monitor_pivot_dir
(
key
,
lxc_conf
,
NULL
);
return
set_config_string_item
(
&
lxc_conf
->
cgroup_meta
.
monitor_pivot_dir
,
value
);
}
static
int
set_config_cgroup_container_dir
(
const
char
*
key
,
const
char
*
value
,
static
int
set_config_cgroup_container_dir
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
void
*
data
)
...
@@ -3870,6 +3882,22 @@ static int get_config_cgroup_monitor_dir(const char *key, char *retv, int inlen,
...
@@ -3870,6 +3882,22 @@ static int get_config_cgroup_monitor_dir(const char *key, char *retv, int inlen,
return
fulllen
;
return
fulllen
;
}
}
static
int
get_config_cgroup_monitor_pivot_dir
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
int
len
;
int
fulllen
=
0
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
strprint
(
retv
,
inlen
,
"%s"
,
lxc_conf
->
cgroup_meta
.
monitor_pivot_dir
);
return
fulllen
;
}
static
int
get_config_cgroup_container_dir
(
const
char
*
key
,
char
*
retv
,
static
int
get_config_cgroup_container_dir
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
int
inlen
,
struct
lxc_conf
*
lxc_conf
,
struct
lxc_conf
*
lxc_conf
,
...
@@ -4768,6 +4796,14 @@ static int clr_config_cgroup_monitor_dir(const char *key,
...
@@ -4768,6 +4796,14 @@ static int clr_config_cgroup_monitor_dir(const char *key,
return
0
;
return
0
;
}
}
static
int
clr_config_cgroup_monitor_pivot_dir
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
free_disarm
(
lxc_conf
->
cgroup_meta
.
monitor_pivot_dir
);
return
0
;
}
static
int
clr_config_cgroup_container_dir
(
const
char
*
key
,
static
int
clr_config_cgroup_container_dir
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
void
*
data
)
...
...
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