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
43647298
Commit
43647298
authored
Mar 07, 2016
by
Serge Hallyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgfsng: try to chown tasks and cgroup.procs
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
41c33dbe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
cgfsng.c
src/lxc/cgfsng.c
+18
-7
No files found.
src/lxc/cgfsng.c
View file @
43647298
...
@@ -1028,6 +1028,9 @@ struct chown_data {
...
@@ -1028,6 +1028,9 @@ struct chown_data {
* chgrp the container cgroups to container group. We leave
* chgrp the container cgroups to container group. We leave
* the container owner as cgroup owner. So we must make the
* the container owner as cgroup owner. So we must make the
* directories 775 so that the container can create sub-cgroups.
* directories 775 so that the container can create sub-cgroups.
*
* Also chown the tasks and cgroup.procs files. Those may not
* exist depending on kernel version.
*/
*/
static
int
chown_cgroup_wrapper
(
void
*
data
)
static
int
chown_cgroup_wrapper
(
void
*
data
)
{
{
...
@@ -1046,19 +1049,27 @@ static int chown_cgroup_wrapper(void *data)
...
@@ -1046,19 +1049,27 @@ static int chown_cgroup_wrapper(void *data)
destuid
=
get_ns_uid
(
arg
->
origuid
);
destuid
=
get_ns_uid
(
arg
->
origuid
);
for
(
i
=
0
;
d
->
hierarchies
[
i
];
i
++
)
{
for
(
i
=
0
;
d
->
hierarchies
[
i
];
i
++
)
{
char
*
fullpath
=
must_make_path
(
d
->
hierarchies
[
i
]
->
fullcgpath
,
NULL
)
;
char
*
fullpath
,
*
path
=
d
->
hierarchies
[
i
]
->
fullcgpath
;
if
(
chown
(
fullpath
,
destuid
,
0
)
<
0
)
{
SYSERROR
(
"Error chowning %s"
,
fullpath
);
if
(
chown
(
path
,
destuid
,
0
)
<
0
)
{
free
(
fullpath
);
SYSERROR
(
"Error chowning %s to %d: %m"
,
path
,
(
int
)
destuid
);
return
-
1
;
return
-
1
;
}
}
if
(
chmod
(
fullpath
,
0775
)
<
0
)
{
if
(
chmod
(
path
,
0775
)
<
0
)
{
SYSERROR
(
"Error chmoding %s
\n
"
,
fullpath
);
SYSERROR
(
"Error chmoding %s: %m"
,
path
);
free
(
fullpath
);
return
-
1
;
return
-
1
;
}
}
/* Failures to chown these are inconvenient but not detrimental */
fullpath
=
must_make_path
(
path
,
"tasks"
,
NULL
);
if
(
chown
(
fullpath
,
destuid
,
0
)
<
0
&&
errno
!=
ENOENT
)
WARN
(
"Failed chowning %s to %d: %m"
,
fullpath
,
(
int
)
destuid
);
free
(
fullpath
);
fullpath
=
must_make_path
(
path
,
"cgroup.procs"
,
NULL
);
if
(
chown
(
fullpath
,
destuid
,
0
)
<
0
&&
errno
!=
ENOENT
)
WARN
(
"Failed chowning %s to %d: %m"
,
fullpath
,
(
int
)
destuid
);
free
(
fullpath
);
free
(
fullpath
);
}
}
...
...
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