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
This check has been wrongly removed with containers#198
The check must stay as it's now part of the Stop/Delete API so reintroduce it back
This fixes containers#233 and the associated CRI-O issues
This PR + cri-o/cri-o#1910 fully fix the issue
I'm going to revendor c/storage in CRI-O to full fix crio after this is merged

Signed-off-by: Antonio Murdaca <[email protected]>
  • Loading branch information
runcom committed Nov 15, 2018
1 parent b28ea40 commit f810101
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 f810101

Please sign in to comment.