Skip to content

Commit

Permalink
layers: do not try to unmount if not mounted at all on delete
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Murdaca <[email protected]>
  • Loading branch information
runcom committed Nov 15, 2018
1 parent b28ea40 commit b9fc462
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 b9fc462

Please sign in to comment.