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
23a20dbe
Unverified
Commit
23a20dbe
authored
Feb 05, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: switch tmpfs mounting to new mount api
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
bfbfeedf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
cgfsng.c
src/lxc/cgroups/cgfsng.c
+16
-7
No files found.
src/lxc/cgroups/cgfsng.c
View file @
23a20dbe
...
@@ -1831,7 +1831,7 @@ static inline int cg_mount_cgroup_full(int type, struct hierarchy *h,
...
@@ -1831,7 +1831,7 @@ static inline int cg_mount_cgroup_full(int type, struct hierarchy *h,
__cgfsng_ops
static
bool
cgfsng_mount
(
struct
cgroup_ops
*
ops
,
__cgfsng_ops
static
bool
cgfsng_mount
(
struct
cgroup_ops
*
ops
,
struct
lxc_conf
*
conf
,
int
type
)
struct
lxc_conf
*
conf
,
int
type
)
{
{
__do_close
int
dfd_mnt_cgroupfs
=
-
EBADF
;
__do_close
int
dfd_mnt_cgroupfs
=
-
EBADF
,
fd_fs
=
-
EBADF
;
__do_free
char
*
cgroup_root
=
NULL
;
__do_free
char
*
cgroup_root
=
NULL
;
bool
has_cgns
=
false
,
wants_force_mount
=
false
;
bool
has_cgns
=
false
,
wants_force_mount
=
false
;
struct
lxc_rootfs
*
rootfs
=
&
conf
->
rootfs
;
struct
lxc_rootfs
*
rootfs
=
&
conf
->
rootfs
;
...
@@ -1908,16 +1908,25 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
...
@@ -1908,16 +1908,25 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
* relying on RESOLVE_BENEATH so we need to skip the leading "/" in the
* relying on RESOLVE_BENEATH so we need to skip the leading "/" in the
* DEFAULT_CGROUP_MOUNTPOINT define.
* DEFAULT_CGROUP_MOUNTPOINT define.
*/
*/
ret
=
mount_at
(
rootfs
->
dfd_mnt
,
NULL
,
DEFAULT_CGROUP_MOUNTPOINT_RELATIVE
,
fd_fs
=
fs_prepare
(
"tmpfs"
,
-
EBADF
,
""
,
0
,
0
);
PROTECT_OPATH_DIRECTORY
,
PROTECT_LOOKUP_BENEATH_XDEV
,
if
(
fd_fs
<
0
)
{
"tmpfs"
,
MS_NOSUID
|
MS_NODEV
|
MS_NOEXEC
|
MS_RELATIME
,
"size=10240k,mode=755"
);
if
(
ret
<
0
&&
errno
==
ENOSYS
)
{
cgroup_root
=
must_make_path
(
rootfs_mnt
,
DEFAULT_CGROUP_MOUNTPOINT
,
NULL
);
cgroup_root
=
must_make_path
(
rootfs_mnt
,
DEFAULT_CGROUP_MOUNTPOINT
,
NULL
);
ret
=
safe_mount
(
NULL
,
cgroup_root
,
"tmpfs"
,
ret
=
safe_mount
(
NULL
,
cgroup_root
,
"tmpfs"
,
MS_NOSUID
|
MS_NODEV
|
MS_NOEXEC
|
MS_RELATIME
,
MS_NOSUID
|
MS_NODEV
|
MS_NOEXEC
|
MS_RELATIME
,
"size=10240k,mode=755"
,
rootfs_mnt
);
"size=10240k,mode=755"
,
rootfs_mnt
);
}
else
{
ret
=
fs_set_property
(
fd_fs
,
"mode"
,
"0755"
);
if
(
ret
<
0
)
return
log_error_errno
(
-
errno
,
errno
,
"Failed to mount tmpfs onto %d(dev)"
,
fd_fs
);
ret
=
fs_set_property
(
fd_fs
,
"size"
,
"10240k"
);
if
(
ret
<
0
)
return
log_error_errno
(
-
errno
,
errno
,
"Failed to mount tmpfs onto %d(dev)"
,
fd_fs
);
ret
=
fs_attach
(
fd_fs
,
rootfs
->
dfd_mnt
,
DEFAULT_CGROUP_MOUNTPOINT_RELATIVE
,
PROTECT_OPATH_DIRECTORY
,
PROTECT_LOOKUP_BENEATH_XDEV
,
MOUNT_ATTR_NOSUID
|
MOUNT_ATTR_NODEV
|
MOUNT_ATTR_NOEXEC
|
MOUNT_ATTR_RELATIME
);
}
}
if
(
ret
<
0
)
if
(
ret
<
0
)
return
log_error_errno
(
false
,
errno
,
"Failed to mount tmpfs on %s"
,
return
log_error_errno
(
false
,
errno
,
"Failed to mount tmpfs on %s"
,
...
...
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