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

12
cache/refs.go vendored
View File

@ -185,7 +185,12 @@ func (sr *immutableRef) Release(ctx context.Context) error {
}
func (sr *immutableRef) release(ctx context.Context) error {
if 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
}
@ -193,11 +198,6 @@ func (sr *immutableRef) release(ctx context.Context) error {
sr.viewMount = nil
}
updateLastUsed(sr.md)
delete(sr.refs, sr)
if len(sr.refs) == 0 {
if sr.equalMutable != nil {
sr.equalMutable.release(ctx)
}