Skip to content

Commit

Permalink
Merge pull request #3297 from kolyshkin/1.0-3226
Browse files Browse the repository at this point in the history
[1.0] Remove sub cgroup when container exits
  • Loading branch information
kolyshkin authored Dec 1, 2021
2 parents 02d2e1f + 2c30069 commit 18457d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libcontainer/cgroups/systemd/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package systemd
import (
"fmt"
"math"
"os"
"path/filepath"
"strconv"
"strings"
Expand Down Expand Up @@ -307,9 +306,10 @@ func (m *unifiedManager) Destroy() error {
return err
}

// XXX this is probably not needed, systemd should handle it
err := os.Remove(m.path)
if err != nil && !os.IsNotExist(err) {
// systemd 239 do not remove sub-cgroups.
err := cgroups.RemovePath(m.path)
// cgroups.RemovePath has handled ErrNotExist
if err != nil {
return err
}

Expand Down

0 comments on commit 18457d8

Please sign in to comment.