Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

fix panic at isAllWritable (#5457)

Konstantin Lebedevd5d8b8e2aef2
diff --git a/weed/topology/volume_layout.go b/weed/topology/volume_layout.go
index 3c1c31aefc..d04552d359 100644
--- a/weed/topology/volume_layout.go
+++ b/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
}