|
@@ -185,7 +185,10 @@ func (cr *cacheRecord) Mount(ctx context.Context, readonly bool) (snapshot.Mount
|
|
|
func (cr *cacheRecord) remove(ctx context.Context, removeSnapshot bool) error {
|
|
|
delete(cr.cm.records, cr.ID())
|
|
|
if cr.parent != nil {
|
|
|
- if err := cr.parent.release(ctx); err != nil {
|
|
|
+ cr.parent.mu.Lock()
|
|
|
+ err := cr.parent.release(ctx)
|
|
|
+ cr.parent.mu.Unlock()
|
|
|
+ if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
}
|
|
@@ -401,11 +404,6 @@ func (sr *mutableRef) release(ctx context.Context) error {
|
|
|
return err
|
|
|
}
|
|
|
}
|
|
|
- if sr.parent != nil {
|
|
|
- if err := sr.parent.release(ctx); err != nil {
|
|
|
- return err
|
|
|
- }
|
|
|
- }
|
|
|
return sr.remove(ctx, true)
|
|
|
} else {
|
|
|
if sr.updateLastUsed() {
|