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
e6d4df78
Unverified
Commit
e6d4df78
authored
Jan 22, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: fix cgroup mounting
Cc: stable-4.0 Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
5d1bf4c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
cgfsng.c
src/lxc/cgroups/cgfsng.c
+11
-3
cgroup.h
src/lxc/cgroups/cgroup.h
+1
-0
utils.c
src/lxc/utils.c
+1
-1
No files found.
src/lxc/cgroups/cgfsng.c
View file @
e6d4df78
...
...
@@ -1871,13 +1871,21 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
return
cg_mount_cgroup_full
(
type
,
ops
->
unified
,
cgroup_root
)
==
0
;
}
/* mount tmpfs */
ret
=
safe_mount_beneath
(
root
,
NULL
,
DEFAULT_CGROUP_MOUNTPOINT
,
"tmpfs"
,
/*
* Mount a tmpfs over DEFAULT_CGROUP_MOUNTPOINT. Note that we're
* relying on RESOLVE_BENEATH so we need to skip the leading "/" in the
* DEFAULT_CGROUP_MOUNTPOINT define.
*/
ret
=
safe_mount_beneath
(
root
,
NULL
,
DEFAULT_CGROUP_MOUNTPOINT_RELATIVE
,
"tmpfs"
,
MS_NOSUID
|
MS_NODEV
|
MS_NOEXEC
|
MS_RELATIME
,
"size=10240k,mode=755"
);
if
(
ret
<
0
)
{
if
(
errno
!=
ENOSYS
)
return
false
;
return
log_error_errno
(
false
,
errno
,
"Failed to mount tmpfs on %s"
,
DEFAULT_CGROUP_MOUNTPOINT
);
ret
=
safe_mount
(
NULL
,
cgroup_root
,
"tmpfs"
,
MS_NOSUID
|
MS_NODEV
|
MS_NOEXEC
|
MS_RELATIME
,
...
...
src/lxc/cgroups/cgroup.h
View file @
e6d4df78
...
...
@@ -11,6 +11,7 @@
#include "macro.h"
#include "memory_utils.h"
#define DEFAULT_CGROUP_MOUNTPOINT_RELATIVE "sys/fs/cgroup"
#define DEFAULT_CGROUP_MOUNTPOINT "/sys/fs/cgroup"
#define DEFAULT_PAYLOAD_CGROUP_PREFIX "lxc.payload."
#define DEFAULT_MONITOR_CGROUP_PREFIX "lxc.monitor."
...
...
src/lxc/utils.c
View file @
e6d4df78
...
...
@@ -1103,7 +1103,7 @@ int __safe_mount_beneath_at(int beneath_fd, const char *src, const char *dst, co
target_fd
=
openat2
(
beneath_fd
,
dst
,
&
how
,
sizeof
(
how
));
if
(
target_fd
<
0
)
return
-
errno
;
return
log_error_errno
(
-
errno
,
errno
,
"Failed to open %d(%s)"
,
beneath_fd
,
dst
)
;
ret
=
snprintf
(
tgt_buf
,
sizeof
(
tgt_buf
),
"/proc/self/fd/%d"
,
target_fd
);
if
(
ret
<
0
||
ret
>=
sizeof
(
tgt_buf
))
return
-
EIO
;
...
...
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