mirror of
https://github.com/containers/podman.git
synced 2025-10-18 11:42:55 +08:00
Mark containers invalid earlier during removal
Fixes a bug where we might try saving back to the database during cleanup, which would fail as the container was already removed from the database. Signed-off-by: Matthew Heon <mheon@redhat.com> Closes: #1001 Approved by: rhatdan
This commit is contained in:
@ -258,6 +258,9 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set container as invalid so it can no longer be used
|
||||||
|
c.valid = false
|
||||||
|
|
||||||
// Clean up network namespace, cgroups, mounts
|
// Clean up network namespace, cgroups, mounts
|
||||||
if err := c.cleanup(); err != nil {
|
if err := c.cleanup(); err != nil {
|
||||||
if cleanupErr == nil {
|
if cleanupErr == nil {
|
||||||
@ -289,9 +292,6 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set container as invalid so it can no longer be used
|
|
||||||
c.valid = false
|
|
||||||
|
|
||||||
return cleanupErr
|
return cleanupErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user