containerd:put get pid lock after set process exited to avoid deadlock

Signed-off-by: zhangsong234 <zhangsong34@huawei.com>
This commit is contained in:
zhangsong234 2022-06-22 14:46:29 +08:00 committed by zhangsong
parent f97170f61e
commit 5cff214452
4 changed files with 46 additions and 2 deletions

View File

@ -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<zhangsong34@huawei.com> - 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<xiadanni1@huawei.com> - 1.2.0-301
- Type:bugfix
- ID:NA

View File

@ -1 +1 @@
188e768fc5b6e679728ee1e7033e481b238b4665
755bdc7a74588295ea632aa10da179cbcce8c64f

View File

@ -0,0 +1,37 @@
From a6c7265aa68fca3a5023ad2b399799db583fffeb Mon Sep 17 00:00:00 2001
From: zhangsong234 <zhangsong34@huawei.com>
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 <zhangsong34@huawei.com>
---
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

View File

@ -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