runc/patch/0005-runc-print-cgroup-info-if-cpuset-missing-occurs.patch

44 lines
1.4 KiB
Diff
Raw Normal View History

2023-01-05 17:11:59 +08:00
From f2a2674f9883e6eb588ce9235161019d31bcedc6 Mon Sep 17 00:00:00 2001
2022-10-26 16:13:47 +08:00
From: zhongjiawei <zhongjiawei1@huawei.com>
2023-01-05 17:11:59 +08:00
Date: Thu, 5 Jan 2023 16:21:10 +0800
2022-10-26 16:13:47 +08:00
Subject: [PATCH] runc: print cgroup info if cpuset missing occurs
---
2023-01-05 17:11:59 +08:00
libcontainer/cgroups/fs/cpuset.go | 20 ++++++++++++++++++++
2022-10-26 16:13:47 +08:00
1 file changed, 20 insertions(+)
2023-01-05 17:11:59 +08:00
diff --git a/libcontainer/cgroups/fs/cpuset.go b/libcontainer/cgroups/fs/cpuset.go
2022-10-26 16:13:47 +08:00
index 550baa4..341d5dc 100644
2023-01-05 17:11:59 +08:00
--- a/libcontainer/cgroups/fs/cpuset.go
+++ b/libcontainer/cgroups/fs/cpuset.go
2022-10-26 16:13:47 +08:00
@@ -172,6 +172,26 @@ func (s *CpusetGroup) ApplyDir(dir string, r *configs.Resources, pid int) error
}
func getCpusetSubsystemSettings(parent string) (cpus, mems string, err error) {
+ defer func() {
+ if err != nil {
+ minfo, err1 := ioutil.ReadFile("/proc/self/mountinfo")
+ if err1 != nil {
+ logrus.Errorf("Failed to read mountinfo when getSubsystemSettings get an error")
+ }
+
+ dirInfo := ""
+ fs, err2 := ioutil.ReadDir(parent)
+ if err2 != nil {
+ logrus.Errorf("Failed to read mountinfo when getSubsystemSettings get an error")
+ }
+ for _, f := range fs {
+ dirInfo = dirInfo + " " + f.Name()
+ }
+
+ logrus.Errorf("Read cpuset cgroup failed, print mountinfo and cgroup info here"+
+ "path: %s, mountinfo: [%s], dirinfo: [%s]", parent, string(minfo), dirInfo)
+ }
+ }()
if cpus, err = cgroups.ReadFile(parent, "cpuset.cpus"); err != nil {
return
}
--
2.30.0