cache: fix possible concurrent maps write on parent release
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>v0.7
parent
2ceaa119e4
commit
1955890445
|
@ -254,7 +254,10 @@ func (cr *cacheRecord) Mount(ctx context.Context, readonly bool) (snapshot.Mount
|
||||||
func (cr *cacheRecord) remove(ctx context.Context, removeSnapshot bool) error {
|
func (cr *cacheRecord) remove(ctx context.Context, removeSnapshot bool) error {
|
||||||
delete(cr.cm.records, cr.ID())
|
delete(cr.cm.records, cr.ID())
|
||||||
if cr.parent != nil {
|
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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue