Skip to content

Commit

Permalink
Ignore already existing cgroupv2 mount point (#427)
Browse files Browse the repository at this point in the history
When the process in an container gets restarted, they reuse the same
filesystem. This means that the mount point we need for mounting
cgroupv2 already exists and we should not fail.
  • Loading branch information
patrickpichler authored Dec 5, 2024
1 parent 0711cd8 commit 9efd6e2
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions pkg/ebpftracer/module_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import (

func mountCgroup2(mountPoint string) error {
err := os.Mkdir(mountPoint, 0755)
if err != nil {
if os.IsExist(err) {
return nil
}
if err != nil && !os.IsExist(err){
return fmt.Errorf("creating directory at %q: %w", mountPoint, err)
}
// https://docs.kernel.org/admin-guide/cgroup-v2.html#mounting
Expand Down

0 comments on commit 9efd6e2

Please sign in to comment.