Skip to content

Commit

Permalink
fix Pod removal after OS hard shutdown
Browse files Browse the repository at this point in the history
In case of a hard OS shutdown, containers may have a "removing"
state after a reboot, and an attempt to remove Pods with such
containers is unsuccessful:

error freeing lock for container ...: no such file or directory

[NO NEW TESTS NEEDED]

Signed-off-by: Mikhail Khachayants <[email protected]>
  • Loading branch information
tyler92 committed Sep 6, 2022
1 parent 46e9178 commit 9585147
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libpod/runtime_ctr.go
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force, remo

// Deallocate the container's lock
if err := c.lock.Free(); err != nil {
if cleanupErr == nil {
if cleanupErr == nil && !os.IsNotExist(err) {
cleanupErr = fmt.Errorf("error freeing lock for container %s: %w", c.ID(), err)
} else {
logrus.Errorf("Free container lock: %v", err)
Expand Down

0 comments on commit 9585147

Please sign in to comment.