Blame SOURCES/f9a2eeb64054e740fb1ae3048dde153c257113c8.patch

a7f575
From f9a2eeb64054e740fb1ae3048dde153c257113c8 Mon Sep 17 00:00:00 2001
a7f575
From: Ulrich Obergfell <uobergfe@redhat.com>
a7f575
Date: Thu, 10 Oct 2019 11:16:50 +0200
a7f575
Subject: [PATCH] revert changes introduced by "fix error handling in restore()
a7f575
 function", commit e96a10aef66e
a7f575
 (https://github.com/projectatomic/containerd/pull/10)
a7f575
a7f575
Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com>
a7f575
---
a7f575
 runtime/container.go     | 12 ++++++------
a7f575
 supervisor/supervisor.go | 11 +++--------
a7f575
 2 files changed, 9 insertions(+), 14 deletions(-)
a7f575
a7f575
diff --git a/runtime/container.go b/runtime/container.go
a7f575
index 14002fc..2e9e663 100644
a7f575
--- a/runtime/container.go
a7f575
+++ b/runtime/container.go
a7f575
@@ -146,15 +146,15 @@ func New(opts ContainerOpts) (Container, error) {
a7f575
 }
a7f575
 
a7f575
 // Load return a new container from the matchin state file on disk.
a7f575
-func Load(root, id, shimName string, timeout time.Duration) (Container, error, string) {
a7f575
+func Load(root, id, shimName string, timeout time.Duration) (Container, error) {
a7f575
 	var s state
a7f575
 	f, err := os.Open(filepath.Join(root, id, StateFile))
a7f575
 	if err != nil {
a7f575
-		return nil, err, "init"
a7f575
+		return nil, err
a7f575
 	}
a7f575
 	defer f.Close()
a7f575
 	if err := json.NewDecoder(f).Decode(&s); err != nil {
a7f575
-		return nil, err, "init"
a7f575
+		return nil, err
a7f575
 	}
a7f575
 	c := &container{
a7f575
 		root:        root,
a7f575
@@ -175,7 +175,7 @@ func Load(root, id, shimName string, timeout time.Duration) (Container, error, s
a7f575
 
a7f575
 	dirs, err := ioutil.ReadDir(filepath.Join(root, id))
a7f575
 	if err != nil {
a7f575
-		return nil, err, "init"
a7f575
+		return nil, err
a7f575
 	}
a7f575
 	for _, d := range dirs {
a7f575
 		if !d.IsDir() {
a7f575
@@ -184,7 +184,7 @@ func Load(root, id, shimName string, timeout time.Duration) (Container, error, s
a7f575
 		pid := d.Name()
a7f575
 		s, err := readProcessState(filepath.Join(root, id, pid))
a7f575
 		if err != nil {
a7f575
-			return nil, err, pid
a7f575
+			return nil, err
a7f575
 		}
a7f575
 		p, err := loadProcess(filepath.Join(root, id, pid), pid, c, s)
a7f575
 		if err != nil {
a7f575
@@ -193,7 +193,7 @@ func Load(root, id, shimName string, timeout time.Duration) (Container, error, s
a7f575
 		}
a7f575
 		c.processes[pid] = p
a7f575
 	}
a7f575
-	return c, nil, ""
a7f575
+	return c, nil
a7f575
 }
a7f575
 
a7f575
 func readProcessState(dir string) (*ProcessState, error) {
a7f575
diff --git a/supervisor/supervisor.go b/supervisor/supervisor.go
a7f575
index d92de8a..e21ae7b 100644
a7f575
--- a/supervisor/supervisor.go
a7f575
+++ b/supervisor/supervisor.go
a7f575
@@ -364,15 +364,10 @@ func (s *Supervisor) restore() error {
a7f575
 			continue
a7f575
 		}
a7f575
 		id := d.Name()
a7f575
-		container, err, pid := runtime.Load(s.stateDir, id, s.shim, s.timeout)
a7f575
+		container, err := runtime.Load(s.stateDir, id, s.shim, s.timeout)
a7f575
 		if err != nil {
a7f575
-			if (pid == "init") {
a7f575
-				logrus.WithFields(logrus.Fields{"error": err, "id": id}).Warnf("containerd: failed to load container,removing state directory.")
a7f575
-				os.RemoveAll(filepath.Join(s.stateDir, id))
a7f575
-			} else {
a7f575
-				logrus.WithFields(logrus.Fields{"error": err, "pid": pid}).Warnf("containerd: failed to load exec process,removing state directory.")
a7f575
-				os.RemoveAll(filepath.Join(s.stateDir, id, pid))
a7f575
-			}
a7f575
+			logrus.WithFields(logrus.Fields{"error": err, "id": id}).Warnf("containerd: failed to load container,removing state directory.")
a7f575
+			os.RemoveAll(filepath.Join(s.stateDir, id))
a7f575
 			continue
a7f575
 		}
a7f575
 		processes, err := container.Processes()