Merge pull request #2123 from kimminss0/zfs-tolerate-already-removed-layer-deletion
drivers/zfs: Handle missing layers during image deletion in ZFS file system
This commit is contained in:
commit
a397602515
|
|
@ -392,12 +392,18 @@ func (d *Driver) Remove(id string) error {
|
||||||
name := d.zfsPath(id)
|
name := d.zfsPath(id)
|
||||||
dataset := zfs.Dataset{Name: name}
|
dataset := zfs.Dataset{Name: name}
|
||||||
err := dataset.Destroy(zfs.DestroyRecursive)
|
err := dataset.Destroy(zfs.DestroyRecursive)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
d.Lock()
|
// We must be tolerant in case the image has already been removed,
|
||||||
delete(d.filesystemsCache, name)
|
// for example, accidentally by hand.
|
||||||
d.Unlock()
|
if _, err1 := zfs.GetDataset(name); err1 == nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
logrus.WithField("storage-driver", "zfs").Debugf("Layer %s has already been removed; ignore it and continue to delete the cache", id)
|
||||||
}
|
}
|
||||||
return err
|
d.Lock()
|
||||||
|
delete(d.filesystemsCache, name)
|
||||||
|
d.Unlock()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns the mountpoint for the given id after creating the target directories if necessary.
|
// Get returns the mountpoint for the given id after creating the target directories if necessary.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue