Browse Source

fix panic at isAllWritable (#5457)

fix panic
https://github.com/seaweedfs/seaweedfs/issues/5456
pull/5462/head
Konstantin Lebedev 9 months ago
committed by GitHub
parent
commit
d5d8b8e2ae
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 13
      weed/topology/volume_layout.go

13
weed/topology/volume_layout.go

@ -234,13 +234,18 @@ func (vl *VolumeLayout) ensureCorrectWritables(vid needle.VolumeId) {
}
func (vl *VolumeLayout) isAllWritable(vid needle.VolumeId) bool {
for _, dn := range vl.vid2location[vid].list {
if v, getError := dn.GetVolumesById(vid); getError == nil {
if v.ReadOnly {
return false
if location, ok := vl.vid2location[vid]; ok {
for _, dn := range location.list {
if v, getError := dn.GetVolumesById(vid); getError == nil {
if v.ReadOnly {
return false
}
}
}
} else {
return false
}
return true
}

Loading…
Cancel
Save