fix panic at isAllWritable (#5457)

fix panic
https://github.com/seaweedfs/seaweedfs/issues/5456
This commit is contained in:
Konstantin Lebedev
2024-04-02 21:06:19 +05:00
committed by GitHub
parent 2a88da4de7
commit d5d8b8e2ae

View File

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