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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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 {
for _, dn := range location.list {
if v, getError := dn.GetVolumesById(vid); getError == nil { if v, getError := dn.GetVolumesById(vid); getError == nil {
if v.ReadOnly { if v.ReadOnly {
return false return false
} }
} }
} }
} else {
return false
}
return true return true
} }