mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-04 04:31:28 +00:00
DeviceMapper: Succeed immediately when removing non-existant devices
We've seen situations where removal of "ID-init" failed during container deletion (EBUSY), after removal of "ID" has succeeded. This caused the container delete operation to fail, and on the next delete attempt the removal of "ID" failed immediately with "does not exist". Ideally we should not fail the ID-init removal, but its also non-ideal to allow a state where the container is half-removed and we cannot make progress deleting the container. So, we silently ignore not-exist errors on device removal. Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
This commit is contained in:
committed by
unclejack
parent
3c9e23c297
commit
63596f8c5d
@@ -90,6 +90,13 @@ func (d *Driver) Create(id, parent string) error {
|
||||
}
|
||||
|
||||
func (d *Driver) Remove(id string) error {
|
||||
if !d.DeviceSet.HasDevice(id) {
|
||||
// Consider removing a non-existing device a no-op
|
||||
// This is useful to be able to progress on container removal
|
||||
// if the underlying device has gone away due to earlier errors
|
||||
return nil
|
||||
}
|
||||
|
||||
// Sink the float from create in case no Get() call was made
|
||||
if err := d.DeviceSet.UnmountDevice(id, UnmountSink); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user