mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
if the Rename during an image delete fails, just delete the original dir
Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
parent
5ad82d3ea6
commit
86a3a9a282
1 changed files with 10 additions and 6 deletions
|
@ -302,13 +302,17 @@ func (graph *Graph) Delete(name string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
tmp, err := graph.Mktemp("")
|
tmp, err := graph.Mktemp("")
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
graph.idIndex.Delete(id)
|
graph.idIndex.Delete(id)
|
||||||
|
if err == nil {
|
||||||
err = os.Rename(graph.ImageRoot(id), tmp)
|
err = os.Rename(graph.ImageRoot(id), tmp)
|
||||||
|
// On err make tmp point to old dir and cleanup unused tmp dir
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
os.RemoveAll(tmp)
|
||||||
|
tmp = graph.ImageRoot(id)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// On err make tmp point to old dir for cleanup
|
||||||
|
tmp = graph.ImageRoot(id)
|
||||||
}
|
}
|
||||||
// Remove rootfs data from the driver
|
// Remove rootfs data from the driver
|
||||||
graph.driver.Remove(id)
|
graph.driver.Remove(id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue