runc/patch/0112-runc-add-log-message-for-cgroup-file-check.patch

46 lines
1.6 KiB
Diff
Raw Normal View History

From f7d616b27608938de3bfdd8f03b9cb38fc404c4e Mon Sep 17 00:00:00 2001
From: zhangtianyang <zhangtianyang2@huawei.com>
Date: Sun, 20 Oct 2019 17:25:23 +0800
Subject: [PATCH] runc: add log message for cgroup file check
reason: docker report "no such file" when try to write cpuset.mems,
not sure weather is deleted or not generated by kernel. so add
cgroup file check messages for further maintainance.
write action will not report error when file not exist, actual
reporter is read action in cgroup copy function.
Change-Id: I8e1620dd67907730f0fc4d4d7004d710c7665aa0
Signed-off-by: zhangtianyang <zhangtianyang2@huawei.com>
---
libcontainer/cgroups/fs/cpuset.go | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/libcontainer/cgroups/fs/cpuset.go b/libcontainer/cgroups/fs/cpuset.go
index bc654948..76cb719b 100644
--- a/libcontainer/cgroups/fs/cpuset.go
+++ b/libcontainer/cgroups/fs/cpuset.go
@@ -161,10 +161,18 @@ func (s *CpusetGroup) copyIfNeeded(current, parent string) error {
)
if currentCpus, currentMems, err = s.getSubsystemSettings(current); err != nil {
- return err
+ ret := fmt.Errorf("failed copy parent cgroup setting, %v", err)
+ if _, err := os.Stat(current); err != nil {
+ ret = fmt.Errorf("%v, %v", ret, err)
+ }
+ return ret
}
if parentCpus, parentMems, err = s.getSubsystemSettings(parent); err != nil {
- return err
+ ret := fmt.Errorf("failed copy parent cgroup setting, %v", err)
+ if _, err := os.Stat(parent); err != nil {
+ ret = fmt.Errorf("%v, %v", ret, err)
+ }
+ return ret
}
if s.isEmpty(currentCpus) {
--
2.19.1