From 4e69ecc42c8421709548586aa878b01098220233 Mon Sep 17 00:00:00 2001 From: zhangsong234 Date: Wed, 22 Jun 2022 14:46:29 +0800 Subject: [PATCH] containerd:put get pid lock after set process exited to avoid deadlock Signed-off-by: zhangsong234 (cherry picked from commit 5cff2144523054a3492c916f9acacc9a34b2a24f) --- containerd.spec | 8 +++- git-commit | 2 +- ...id-lock-after-set-process-exited-to-.patch | 37 +++++++++++++++++++ series.conf | 1 + 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 patch/0085-containerd-put-get-pid-lock-after-set-process-exited-to-.patch diff --git a/containerd.spec b/containerd.spec index b2087d1..377667c 100644 --- a/containerd.spec +++ b/containerd.spec @@ -2,7 +2,7 @@ %global debug_package %{nil} Version: 1.2.0 Name: containerd -Release: 301 +Release: 302 Summary: An industry-standard container runtime License: ASL 2.0 URL: https://containerd.io @@ -52,6 +52,12 @@ install -p -m 755 bin/containerd-shim $RPM_BUILD_ROOT/%{_bindir}/containerd-shim %{_bindir}/containerd-shim %changelog +* Wed Jun 22 2022 zhangsong234 - 1.2.0-302 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:put get pid lock after set process exited to avoid deadlock + * Tue May 10 2022 Vanient - 1.2.0-301 - Type:bugfix - ID:NA diff --git a/git-commit b/git-commit index 7a61d60..068a20e 100644 --- a/git-commit +++ b/git-commit @@ -1 +1 @@ -188e768fc5b6e679728ee1e7033e481b238b4665 +755bdc7a74588295ea632aa10da179cbcce8c64f diff --git a/patch/0085-containerd-put-get-pid-lock-after-set-process-exited-to-.patch b/patch/0085-containerd-put-get-pid-lock-after-set-process-exited-to-.patch new file mode 100644 index 0000000..4ab36bb --- /dev/null +++ b/patch/0085-containerd-put-get-pid-lock-after-set-process-exited-to-.patch @@ -0,0 +1,37 @@ +From a6c7265aa68fca3a5023ad2b399799db583fffeb Mon Sep 17 00:00:00 2001 +From: zhangsong234 +Date: Tue, 14 Jun 2022 10:25:47 +0800 +Subject: [PATCH] containerd: put get pid lock after set process exited to avoid + deadlock. + +Signed-off-by: zhangsong234 +--- + runtime/v1/linux/proc/exec.go | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/runtime/v1/linux/proc/exec.go b/runtime/v1/linux/proc/exec.go +index a5f40bd..ff967b5 100644 +--- a/runtime/v1/linux/proc/exec.go ++++ b/runtime/v1/linux/proc/exec.go +@@ -86,14 +86,14 @@ func (e *execProcess) ExitedAt() time.Time { + } + + func (e *execProcess) SetExited(status int) { +- e.pid.Lock() +- e.pid.pid = -1 +- e.pid.Unlock() +- + e.mu.Lock() + defer e.mu.Unlock() + + e.execState.SetExited(status) ++ ++ e.pid.Lock() ++ e.pid.pid = -1 ++ e.pid.Unlock() + } + + func (e *execProcess) setExited(status int) { +-- +2.27.0 + diff --git a/series.conf b/series.conf index 5645ef4..176905a 100644 --- a/series.conf +++ b/series.conf @@ -89,4 +89,5 @@ patch/0081-containerd-reduce-permissions-for-bundle-di.patch patch/0082-containerd-fix-publish-command-wait-block-for.patch patch/0083-containerd-optimize-cgo-compile-options.patch patch/0084-containerd-Use-fs.RootPath-when-mounting-vo.patch +patch/0085-containerd-put-get-pid-lock-after-set-process-exited-to-.patch # end -- Gitee