From 8574e6b2815f1dcb6a60b80da23249f2ecf17837 Mon Sep 17 00:00:00 2001 From: zhongjiawei Date: Thu, 19 Oct 2023 10:19:33 +0800 Subject: [PATCH] containerd:fix some bugs after version upgrade (cherry picked from commit 8aba0d5156b1fe7586a04b3c032891d64956a086) --- containerd.spec | 8 ++- git-commit | 2 +- ...1-containerd-fix-some-containerd-bug.patch | 58 +++++++++++++++++++ series.conf | 1 + 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 patch/0031-containerd-fix-some-containerd-bug.patch diff --git a/containerd.spec b/containerd.spec index 540b02c..b3d9881 100644 --- a/containerd.spec +++ b/containerd.spec @@ -2,7 +2,7 @@ %global debug_package %{nil} Version: 1.6.22 Name: containerd -Release: 3 +Release: 4 Summary: An industry-standard container runtime License: ASL 2.0 URL: https://containerd.io @@ -67,6 +67,12 @@ install -D -p -m 0644 %{S:7} %{buildroot}%{_sysconfdir}/containerd/config.toml %exclude %{_bindir}/containerd-stress %changelog +* Thu Oct 19 2023 zhongjiawei - 1.6.22-4 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix some bugs after version upgrade + * Tue Sep 19 2023 zhongjiawei - 1.6.22-3 - Type:bugfix - ID:NA diff --git a/git-commit b/git-commit index 86c295d..3aee35a 100644 --- a/git-commit +++ b/git-commit @@ -1 +1 @@ -495056854f1bd0e7e88da11867a70629276604b6 +d7a5b33a59e6736009eabe49861eaf58ccf70fe2 diff --git a/patch/0031-containerd-fix-some-containerd-bug.patch b/patch/0031-containerd-fix-some-containerd-bug.patch new file mode 100644 index 0000000..624f6e9 --- /dev/null +++ b/patch/0031-containerd-fix-some-containerd-bug.patch @@ -0,0 +1,58 @@ +From 086561d24d39af5cbc4d0d830e56c36e37e06df9 Mon Sep 17 00:00:00 2001 +From: zhongjiawei +Date: Thu, 19 Oct 2023 10:08:49 +0800 +Subject: [PATCH] containerd:fix some containerd bug + +First,fix the bug the container status is not returned correctly +when executing the docker ps command. +Second,fix the bug executing the docker top command does not return correct data + +Signed-off-by: zhongjiawei +--- + pkg/process/init.go | 9 ++++++++- + vendor/github.com/containerd/go-runc/runc.go | 2 +- + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/pkg/process/init.go b/pkg/process/init.go +index d373851..d48e5c6 100644 +--- a/pkg/process/init.go ++++ b/pkg/process/init.go +@@ -250,7 +250,14 @@ func (p *Init) Status(ctx context.Context) (string, error) { + p.mu.Lock() + defer p.mu.Unlock() + +- return p.initState.Status(ctx) ++ c, err := p.runtime.State(ctx, p.id) ++ if err != nil { ++ if strings.Contains(err.Error(), "does not exist") { ++ return "stopped", nil ++ } ++ return "", p.runtimeError(err, "OCI runtime state failed") ++ } ++ return c.Status, nil + } + + // Start the init process +diff --git a/vendor/github.com/containerd/go-runc/runc.go b/vendor/github.com/containerd/go-runc/runc.go +index 6042b72..5804f5a 100644 +--- a/vendor/github.com/containerd/go-runc/runc.go ++++ b/vendor/github.com/containerd/go-runc/runc.go +@@ -747,6 +747,7 @@ func (r *Runc) runOrErrorTimeout(cmd *exec.Cmd, runTimeout int64) error { + return err + } + data, err := cmdOutputTimeout(cmd, true, nil, runTimeout) ++ defer putBuf(data) + if err != nil { + return fmt.Errorf("%s: %s", err, data) + } +@@ -780,7 +781,6 @@ func cmdOutput(cmd *exec.Cmd, combined bool, started chan<- int) (*bytes.Buffer, + + func cmdOutputTimeout(cmd *exec.Cmd, combined bool, started chan<- int, timeout int64) (*bytes.Buffer, error) { + b := getBuf() +- defer putBuf(b) + + cmd.Stdout = b + if combined { +-- +2.33.0 + diff --git a/series.conf b/series.conf index 1c2a92f..83015e1 100644 --- a/series.conf +++ b/series.conf @@ -28,3 +28,4 @@ patch/0027-containerd-fix-allow-attaching-to-any-combination-of-stdin-stdo.patch patch/0028-containerd-bugfix-add-nil-pointer-check-for-cgroup-v1-mem-usage.patch patch/0029-containerd-fix-unable-to-checkpoint-the-container-more-than-onc.patch patch/0030-containerd-fix-cio.Cancel-should-close-the-pipes.patch +patch/0031-containerd-fix-some-containerd-bug.patch -- Gitee