From c211ec4f492c47ec2673c36dac687a717b709b7e Mon Sep 17 00:00:00 2001 From: Goutham Veeramachaneni Date: Wed, 24 May 2017 16:58:04 +0530 Subject: [PATCH] Fix concurrent map access. Signed-off-by: Goutham Veeramachaneni --- head.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/head.go b/head.go index 704c0b222b..dd441f7973 100644 --- a/head.go +++ b/head.go @@ -260,9 +260,12 @@ Outer: return err } + // Map is accessed in other places also, so protect it. + h.mtx.Lock() for k, v := range newStones { h.tombstones[k] = h.tombstones[k].add(v[0]) } + h.mtx.Unlock() h.meta.NumTombstones = int64(len(h.tombstones)) return nil