From 68168b75df5b4e23e80a8b20275c50b2c50a4e5e Mon Sep 17 00:00:00 2001 From: Zoe Date: Mon, 3 Apr 2023 21:44:23 +0800 Subject: [PATCH] bugfix: avoid an occasional "permission denied" error while frozen failed. #3803 --- libcontainer/cgroups/systemd/v1.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libcontainer/cgroups/systemd/v1.go b/libcontainer/cgroups/systemd/v1.go index ab9333cb2c8..5e1e59391eb 100644 --- a/libcontainer/cgroups/systemd/v1.go +++ b/libcontainer/cgroups/systemd/v1.go @@ -356,6 +356,15 @@ func (m *LegacyManager) Set(r *configs.Resources) error { if err := m.doFreeze(configs.Frozen); err != nil { // If freezer cgroup isn't supported, we just warn about it. logrus.Infof("freeze container before SetUnitProperties failed: %v", err) + // skip update the cgroup while frozen failed. #3803 + if err != errSubsystemDoesNotExist { + if needsThaw { + if thawErr := m.doFreeze(configs.Thawed); thawErr != nil { + logrus.Infof("thaw container after SetUnitProperties failed: %v", thawErr) + } + } + return err + } } } setErr := setUnitProperties(m.dbus, unitName, properties...)