Skip to content

Commit

Permalink
Merge pull request #240 from runcom/fix-kata-devmapper
Browse files Browse the repository at this point in the history
layers: do not try to unmount if not mounted at all on delete
  • Loading branch information
rhatdan authored Nov 15, 2018
2 parents b28ea40 + f810101 commit 3161726
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions layers.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,12 @@ func (r *layerStore) Delete(id string) error {
return ErrLayerUnknown
}
id = layer.ID
if _, err := r.Unmount(id, true); err != nil {
return err
// This check is needed for idempotency of delete where the layer could have been
// already unmounted (since c/storage gives you that API directly)
for layer.MountCount > 0 {
if _, err := r.Unmount(id, false); err != nil {
return err
}
}
err := r.driver.Remove(id)
if err == nil {
Expand Down

0 comments on commit 3161726

Please sign in to comment.