Skip to content

Commit 0eafef8

Browse files
authored
Merge pull request moby#4010 from alexcb/acb/contenthash-race
contenthash: data race
2 parents 31a9120 + caa9579 commit 0eafef8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cache/contenthash/checksum.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ func (cm *cacheManager) GetCacheContext(ctx context.Context, md cache.RefMetadat
110110
cm.lruMu.Unlock()
111111
if ok {
112112
cm.locker.Unlock(md.ID())
113+
v.(*cacheContext).mu.Lock() // locking is required because multiple ImmutableRefs can reach this code; however none of them use the linkMap.
113114
v.(*cacheContext).linkMap = map[string][][]byte{}
115+
v.(*cacheContext).mu.Unlock()
114116
return v.(*cacheContext), nil
115117
}
116118
cc, err := newCacheContext(md)

0 commit comments

Comments
 (0)