cache: make sure mutable refs are not finalized on exporting cache

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2022-12-12 15:54:50 -08:00
parent 926451eee8
commit ab0d1a6eea

8
cache/blobs.go vendored
View File

@@ -36,6 +36,14 @@ func (sr *immutableRef) computeBlobChain(ctx context.Context, createIfNeeded boo
if _, ok := leases.FromContext(ctx); !ok {
return errors.Errorf("missing lease requirement for computeBlobChain")
}
if !createIfNeeded {
sr.mu.Lock()
if sr.equalMutable != nil {
sr.mu.Unlock()
return nil
}
sr.mu.Unlock()
}
if err := sr.Finalize(ctx); err != nil {
return err