cache: remove view on last release

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2017-12-11 15:35:42 -08:00
parent 013f95eaf7
commit 41be7f1ab8
1 changed files with 8 additions and 8 deletions

16
cache/refs.go vendored
View File

@ -185,19 +185,19 @@ func (sr *immutableRef) Release(ctx context.Context) error {
}
func (sr *immutableRef) release(ctx context.Context) error {
if sr.viewMount != nil {
if err := sr.cm.Snapshotter.Remove(ctx, sr.view); err != nil {
return err
}
sr.view = ""
sr.viewMount = nil
}
updateLastUsed(sr.md)
delete(sr.refs, sr)
if len(sr.refs) == 0 {
if sr.viewMount != nil { // TODO: release viewMount earlier if possible
if err := sr.cm.Snapshotter.Remove(ctx, sr.view); err != nil {
return err
}
sr.view = ""
sr.viewMount = nil
}
if sr.equalMutable != nil {
sr.equalMutable.release(ctx)
}