Merge pull request #613 from tonistiigi/data-race

solver: fix data race
docker-18.09
Akihiro Suda 2018-09-08 11:30:13 +09:00 committed by GitHub
commit 0b97b27a23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -444,6 +444,7 @@ func (j *Job) Discard() error {
j.pw.Close() j.pw.Close()
for k, st := range j.list.actives { for k, st := range j.list.actives {
st.mu.Lock()
if _, ok := st.jobs[j]; ok { if _, ok := st.jobs[j]; ok {
delete(st.jobs, j) delete(st.jobs, j)
j.list.deleteIfUnreferenced(k, st) j.list.deleteIfUnreferenced(k, st)
@ -451,6 +452,7 @@ func (j *Job) Discard() error {
if _, ok := st.allPw[j.pw]; ok { if _, ok := st.allPw[j.pw]; ok {
delete(st.allPw, j.pw) delete(st.allPw, j.pw)
} }
st.mu.Unlock()
} }
return nil return nil
} }