mirror of
https://github.com/containers/podman.git
synced 2025-10-19 12:12:36 +08:00
vendor: update c/common
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
4
vendor/github.com/checkpoint-restore/go-criu/v7/.golangci.yml
generated
vendored
4
vendor/github.com/checkpoint-restore/go-criu/v7/.golangci.yml
generated
vendored
@ -16,3 +16,7 @@ linters:
|
||||
linters-settings:
|
||||
exhaustive:
|
||||
default-signifies-exhaustive: true
|
||||
gosec:
|
||||
excludes:
|
||||
# https://github.com/securego/gosec/issues/1185
|
||||
- G115
|
||||
|
3
vendor/github.com/checkpoint-restore/go-criu/v7/README.md
generated
vendored
3
vendor/github.com/checkpoint-restore/go-criu/v7/README.md
generated
vendored
@ -62,7 +62,8 @@ The following table shows the relation between go-criu and criu versions:
|
||||
|
||||
| Major version | Latest release | CRIU version |
|
||||
| -------------- | -------------- | ------------ |
|
||||
| v7 | 7.1.0 | 3.18 |
|
||||
| v7 | 7.2.0 | 3.19 |
|
||||
| v7 | 7.0.0 | 3.18 |
|
||||
| v6 | 6.3.0 | 3.17 |
|
||||
| v5 | 5.3.0 | 3.16 |
|
||||
| v5 | 5.0.0 | 3.15 |
|
||||
|
46
vendor/github.com/containers/common/pkg/cgroups/cgroups_linux.go
generated
vendored
46
vendor/github.com/containers/common/pkg/cgroups/cgroups_linux.go
generated
vendored
@ -95,7 +95,8 @@ func init() {
|
||||
func getAvailableControllers(exclude map[string]controllerHandler, cgroup2 bool) ([]controller, error) {
|
||||
if cgroup2 {
|
||||
controllers := []controller{}
|
||||
controllersFile := cgroupRoot + "/cgroup.controllers"
|
||||
controllersFile := filepath.Join(cgroupRoot, "cgroup.controllers")
|
||||
|
||||
// rootless cgroupv2: check available controllers for current user, systemd or servicescope will inherit
|
||||
if unshare.IsRootless() {
|
||||
userSlice, err := getCgroupPathForCurrentProcess()
|
||||
@ -104,7 +105,7 @@ func getAvailableControllers(exclude map[string]controllerHandler, cgroup2 bool)
|
||||
}
|
||||
// userSlice already contains '/' so not adding here
|
||||
basePath := cgroupRoot + userSlice
|
||||
controllersFile = basePath + "/cgroup.controllers"
|
||||
controllersFile = filepath.Join(basePath, "cgroup.controllers")
|
||||
}
|
||||
controllersFileBytes, err := os.ReadFile(controllersFile)
|
||||
if err != nil {
|
||||
@ -597,7 +598,7 @@ func createCgroupv2Path(path string) (deferredError error) {
|
||||
if !strings.HasPrefix(path, cgroupRoot+"/") {
|
||||
return fmt.Errorf("invalid cgroup path %s", path)
|
||||
}
|
||||
content, err := os.ReadFile(cgroupRoot + "/cgroup.controllers")
|
||||
content, err := os.ReadFile(filepath.Join(cgroupRoot, "cgroup.controllers"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -625,8 +626,43 @@ func createCgroupv2Path(path string) (deferredError error) {
|
||||
// We enable the controllers for all the path components except the last one. It is not allowed to add
|
||||
// PIDs if there are already enabled controllers.
|
||||
if i < len(elements[3:])-1 {
|
||||
if err := os.WriteFile(filepath.Join(current, "cgroup.subtree_control"), res, 0o755); err != nil {
|
||||
return err
|
||||
subtreeControl := filepath.Join(current, "cgroup.subtree_control")
|
||||
if err := os.WriteFile(subtreeControl, res, 0o755); err != nil {
|
||||
// The kernel returns ENOENT either if the file itself is missing, or a controller
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
if err2 := fileutils.Exists(subtreeControl); err2 != nil {
|
||||
// If the file itself is missing, return the original error.
|
||||
return err
|
||||
}
|
||||
repeatAttempts := 1000
|
||||
for repeatAttempts > 0 {
|
||||
// store the controllers that failed to be enabled, so we can retry them
|
||||
newCtrs := [][]byte{}
|
||||
for _, ctr := range ctrs {
|
||||
// Try to enable each controller individually, at least we can give a better error message if any fails.
|
||||
if err := os.WriteFile(subtreeControl, []byte(fmt.Sprintf("+%s\n", ctr)), 0o755); err != nil {
|
||||
// The kernel can return EBUSY when a process was moved to a sub-cgroup
|
||||
// and the controllers are enabled in its parent cgroup. Retry a few times when
|
||||
// it happens.
|
||||
if errors.Is(err, unix.EBUSY) {
|
||||
newCtrs = append(newCtrs, ctr)
|
||||
} else {
|
||||
return fmt.Errorf("enabling controller %s: %w", ctr, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(newCtrs) == 0 {
|
||||
err = nil
|
||||
break
|
||||
}
|
||||
ctrs = newCtrs
|
||||
repeatAttempts--
|
||||
time.Sleep(time.Millisecond)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user