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
e18e9053
Unverified
Commit
e18e9053
authored
Feb 21, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: rename cgroupfs mount fd
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
a9db9474
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
cgfsng.c
src/lxc/cgroups/cgfsng.c
+9
-9
cgroup.c
src/lxc/cgroups/cgroup.c
+2
-2
cgroup.h
src/lxc/cgroups/cgroup.h
+1
-1
No files found.
src/lxc/cgroups/cgfsng.c
View file @
e18e9053
...
@@ -3084,11 +3084,11 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
...
@@ -3084,11 +3084,11 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
if
(
IS_ERR
(
current_cgroup
))
if
(
IS_ERR
(
current_cgroup
))
return
PTR_ERR
(
current_cgroup
);
return
PTR_ERR
(
current_cgroup
);
if
(
unified_cgroup_fd
(
ops
->
dfd_mnt
_cgroupfs_host
))
{
if
(
unified_cgroup_fd
(
ops
->
dfd_mnt
))
{
dfd_mnt
=
dup_cloexec
(
ops
->
dfd_mnt
_cgroupfs_host
);
dfd_mnt
=
dup_cloexec
(
ops
->
dfd_mnt
);
unified_mnt
=
""
;
unified_mnt
=
""
;
}
else
{
}
else
{
dfd_mnt
=
open_at
(
ops
->
dfd_mnt
_cgroupfs_host
,
dfd_mnt
=
open_at
(
ops
->
dfd_mnt
,
"unified"
,
"unified"
,
PROTECT_OPATH_DIRECTORY
,
PROTECT_OPATH_DIRECTORY
,
PROTECT_LOOKUP_ABSOLUTE_XDEV
,
0
);
PROTECT_LOOKUP_ABSOLUTE_XDEV
,
0
);
...
@@ -3096,7 +3096,7 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
...
@@ -3096,7 +3096,7 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
}
}
if
(
dfd_mnt
<
0
)
{
if
(
dfd_mnt
<
0
)
{
if
(
errno
!=
ENOENT
)
if
(
errno
!=
ENOENT
)
return
syserrno
(
-
errno
,
"Failed to open %d/unified"
,
ops
->
dfd_mnt
_cgroupfs_host
);
return
syserrno
(
-
errno
,
"Failed to open %d/unified"
,
ops
->
dfd_mnt
);
SYSTRACE
(
"Unified cgroup not mounted"
);
SYSTRACE
(
"Unified cgroup not mounted"
);
continue
;
continue
;
...
@@ -3146,13 +3146,13 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
...
@@ -3146,13 +3146,13 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
if
(
!
controllers
)
if
(
!
controllers
)
return
ret_errno
(
ENOMEM
);
return
ret_errno
(
ENOMEM
);
dfd_mnt
=
open_at
(
ops
->
dfd_mnt
_cgroupfs_host
,
dfd_mnt
=
open_at
(
ops
->
dfd_mnt
,
controllers
,
PROTECT_OPATH_DIRECTORY
,
controllers
,
PROTECT_OPATH_DIRECTORY
,
PROTECT_LOOKUP_ABSOLUTE_XDEV
,
0
);
PROTECT_LOOKUP_ABSOLUTE_XDEV
,
0
);
if
(
dfd_mnt
<
0
)
{
if
(
dfd_mnt
<
0
)
{
if
(
errno
!=
ENOENT
)
if
(
errno
!=
ENOENT
)
return
syserrno
(
-
errno
,
"Failed to open %d/%s"
,
return
syserrno
(
-
errno
,
"Failed to open %d/%s"
,
ops
->
dfd_mnt
_cgroupfs_host
,
controllers
);
ops
->
dfd_mnt
,
controllers
);
SYSTRACE
(
"%s not mounted"
,
controllers
);
SYSTRACE
(
"%s not mounted"
,
controllers
);
continue
;
continue
;
...
@@ -3236,7 +3236,7 @@ static int initialize_cgroups(struct cgroup_ops *ops, struct lxc_conf *conf)
...
@@ -3236,7 +3236,7 @@ static int initialize_cgroups(struct cgroup_ops *ops, struct lxc_conf *conf)
int
ret
;
int
ret
;
const
char
*
controllers_use
;
const
char
*
controllers_use
;
if
(
ops
->
dfd_mnt
_cgroupfs_host
>=
0
)
if
(
ops
->
dfd_mnt
>=
0
)
return
ret_errno
(
EBUSY
);
return
ret_errno
(
EBUSY
);
/*
/*
...
@@ -3270,7 +3270,7 @@ static int initialize_cgroups(struct cgroup_ops *ops, struct lxc_conf *conf)
...
@@ -3270,7 +3270,7 @@ static int initialize_cgroups(struct cgroup_ops *ops, struct lxc_conf *conf)
* once we know the initialization succeeded. So if we fail we clean up
* once we know the initialization succeeded. So if we fail we clean up
* the dfd.
* the dfd.
*/
*/
ops
->
dfd_mnt
_cgroupfs_host
=
dfd
;
ops
->
dfd_mnt
=
dfd
;
ret
=
__initialize_cgroups
(
ops
,
conf
->
cgroup_meta
.
relative
,
!
lxc_list_empty
(
&
conf
->
id_map
));
ret
=
__initialize_cgroups
(
ops
,
conf
->
cgroup_meta
.
relative
,
!
lxc_list_empty
(
&
conf
->
id_map
));
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -3308,7 +3308,7 @@ struct cgroup_ops *cgroup_ops_init(struct lxc_conf *conf)
...
@@ -3308,7 +3308,7 @@ struct cgroup_ops *cgroup_ops_init(struct lxc_conf *conf)
return
ret_set_errno
(
NULL
,
ENOMEM
);
return
ret_set_errno
(
NULL
,
ENOMEM
);
cgfsng_ops
->
cgroup_layout
=
CGROUP_LAYOUT_UNKNOWN
;
cgfsng_ops
->
cgroup_layout
=
CGROUP_LAYOUT_UNKNOWN
;
cgfsng_ops
->
dfd_mnt
_cgroupfs_host
=
-
EBADF
;
cgfsng_ops
->
dfd_mnt
=
-
EBADF
;
if
(
initialize_cgroups
(
cgfsng_ops
,
conf
))
if
(
initialize_cgroups
(
cgfsng_ops
,
conf
))
return
NULL
;
return
NULL
;
...
...
src/lxc/cgroups/cgroup.c
View file @
e18e9053
...
@@ -73,8 +73,8 @@ void cgroup_exit(struct cgroup_ops *ops)
...
@@ -73,8 +73,8 @@ void cgroup_exit(struct cgroup_ops *ops)
bpf_device_program_free
(
ops
);
bpf_device_program_free
(
ops
);
if
(
ops
->
dfd_mnt
_cgroupfs_host
>=
0
)
if
(
ops
->
dfd_mnt
>=
0
)
close
(
ops
->
dfd_mnt
_cgroupfs_host
);
close
(
ops
->
dfd_mnt
);
for
(
struct
hierarchy
**
it
=
ops
->
hierarchies
;
it
&&
*
it
;
it
++
)
{
for
(
struct
hierarchy
**
it
=
ops
->
hierarchies
;
it
&&
*
it
;
it
++
)
{
for
(
char
**
p
=
(
*
it
)
->
controllers
;
p
&&
*
p
;
p
++
)
for
(
char
**
p
=
(
*
it
)
->
controllers
;
p
&&
*
p
;
p
++
)
...
...
src/lxc/cgroups/cgroup.h
View file @
e18e9053
...
@@ -130,7 +130,7 @@ struct cgroup_ops {
...
@@ -130,7 +130,7 @@ struct cgroup_ops {
* So for CGROUP_LAYOUT_LEGACY or CGROUP_LAYOUT_HYBRID we allow
* So for CGROUP_LAYOUT_LEGACY or CGROUP_LAYOUT_HYBRID we allow
* mountpoint crossing iff we cross from a tmpfs into a cgroupfs mount.
* mountpoint crossing iff we cross from a tmpfs into a cgroupfs mount.
* */
* */
int
dfd_mnt
_cgroupfs_host
;
int
dfd_mnt
;
/* What controllers is the container supposed to use. */
/* What controllers is the container supposed to use. */
char
**
cgroup_use
;
char
**
cgroup_use
;
...
...
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