topology: return a copy from VolumeLayout.Lookup

Callers iterating the returned slice raced with registrations and
removals replacing the location list in place.
This commit is contained in:
Chris Lu
2026-10-19 03:10:22 -07:00
parent bdfd31d799
commit fad3da7906
+1 -1
View File
@@ -591,7 +591,7 @@ func (vl *VolumeLayout) Lookup(vid needle.VolumeId) []*DataNode {
defer vl.accessLock.RUnlock()
if location := vl.vid2location[vid]; location != nil {
return location.list
return append([]*DataNode(nil), location.list...)
}
return nil
}