From 891380374a5a0e6f57b8c67a3d64680b1fef55c0 Mon Sep 17 00:00:00 2001 From: tnextday Date: Wed, 30 Mar 2016 23:14:37 +0800 Subject: [PATCH] fix a data race bug --- weed/topology/volume_layout.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weed/topology/volume_layout.go b/weed/topology/volume_layout.go index 7e3f3264d..e9e4cfaf4 100644 --- a/weed/topology/volume_layout.go +++ b/weed/topology/volume_layout.go @@ -115,7 +115,7 @@ func (vl *VolumeLayout) PickForWrite(count uint64, option *VolumeGrowOption) (*s vid := vl.writables[rand.Intn(len_writers)] locationList := vl.vid2location[vid] if locationList != nil { - return &vid, count, locationList, nil + return &vid, count, locationList.Duplicate(), nil } return nil, 0, nil, errors.New("Strangely vid " + vid.String() + " is on no machine!") }