Browse Source

Merge pull request #4499 from alexlarsson/fix-remove-fail

DeviceMapper: Succeed immediately when removing non-existant devices
Guillaume J. Charmes 11 years ago
parent
commit
af3ff044a2
1 changed files with 7 additions and 0 deletions
  1. 7 0
      graphdriver/devmapper/driver.go

+ 7 - 0
graphdriver/devmapper/driver.go

@@ -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