Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor libcontainerd to minimize containerd RPCs #43564

Merged
merged 7 commits into from Aug 25, 2022
9 changes: 8 additions & 1 deletion daemon/delete.go
Expand Up @@ -138,7 +138,14 @@ func (daemon *Daemon) cleanupContainer(container *container.Container, config ty
container.RWLayer = nil
}

if err := containerfs.EnsureRemoveAll(container.Root); err != nil {
// Hold the container lock while deleting the container root directory
// so that other goroutines don't attempt to concurrently open files
Comment on lines +141 to +142
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find 👍

// within it. Having any file open on Windows (without the
// FILE_SHARE_DELETE flag) will block it from being deleted.
container.Lock()
err := containerfs.EnsureRemoveAll(container.Root)
container.Unlock()
if err != nil {
err = errors.Wrapf(err, "unable to remove filesystem for %s", container.ID)
container.SetRemovalError(err)
return err
Expand Down