containerd/patch/0076-containerd-fix-start-container-failed-with-id-exists.patch
songyanting 19583b7229 containerd: update patches
0069-containerd-add-check-in-spec.patch
0070-containerd-kill-container-init-process-if-runc-start.patch
0071-containerd-fix-containerd-shim-residual-when-kill-co.patch
0072-containerd-fix-deadlock-on-commit-error.patch
0073-containerd-backport-upstream-patches.patch
0074-containerd-fix-exec-event-missing-due-to-pid-reuse.patch
0075-containerd-fix-dm-left-when-pause-contaienr-and-kill-shim.patch
0076-containerd-fix-start-container-failed-with-id-exists.patch
0077-containerd-drop-opt-package.patch
0078-containerd-bump-containerd-ttrpc-699c4e40d1.patch
0079-containerd-fix-race-access-for-mobySubcribed.patch
0080-containerd-improve-log-for-debugging.patch
0081-containerd-reduce-permissions-for-bundle-di.patch
0082-containerd-fix-publish-command-wait-block-for.patch
0083-containerd-optimize-cgo-compile-options.patch

Signed-off-by:songyanting <songyanting@huawei.com>
2022-01-26 20:03:57 +08:00

35 lines
1.5 KiB
Diff

From 6936dda1f72b328cacfc29b52da780a29ef45385 Mon Sep 17 00:00:00 2001
From: xiadanni <xiadanni1@huawei.com>
Date: Thu, 8 Jul 2021 14:37:56 +0800
Subject: [PATCH] containerd: fix start container failed with id exists
reason: If container root path already exists when call runtime.Create,
we try to call runtime.Delete to cleanup it. But in case runtime.Delete
failed, root path will still exists which causes Create failed with error
"container with id exists". So remove path directly if Delete failed.
Signed-off-by: xiadanni <xiadanni1@huawei.com>
---
vendor/github.com/containerd/go-runc/runc.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/vendor/github.com/containerd/go-runc/runc.go b/vendor/github.com/containerd/go-runc/runc.go
index 1c96317..c089381 100644
--- a/vendor/github.com/containerd/go-runc/runc.go
+++ b/vendor/github.com/containerd/go-runc/runc.go
@@ -159,7 +159,10 @@ func (o *CreateOpts) args() (out []string, err error) {
func (r *Runc) Create(context context.Context, id, bundle string, opts *CreateOpts) error {
if _, err := os.Stat(filepath.Join(r.Root, id)); err == nil {
logrus.Warnf("cleanup residue runtime with bundle %s root=%s", bundle, r.Root)
- r.Delete(context, id, &DeleteOpts{Force: true})
+ if dErr := r.Delete(context, id, &DeleteOpts{Force: true}); dErr != nil {
+ logrus.Errorf("runtime force delete return err: %v, remove container root err: %v",
+ dErr, os.RemoveAll(filepath.Join(r.Root, id)))
+ }
}
args := []string{"create", "--bundle", bundle}
--
2.27.0