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.

volume: avoid deadlock when deleting volumes

Chris Lua1c01d716b2f
diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go
index 9ecc574593..c309b3f925 100644
--- a/weed/storage/disk_location.go
+++ b/weed/storage/disk_location.go
@@ -174,9 +174,6 @@ func (l *DiskLocation) DeleteCollectionFromDiskLocation(collection string) (e er
}
func (l *DiskLocation) deleteVolumeById(vid needle.VolumeId) (found bool, e error) {
- l.volumesLock.Lock()
- defer l.volumesLock.Unlock()
-
v, ok := l.volumes[vid]
if !ok {
return
diff --git a/weed/storage/store.go b/weed/storage/store.go
index 48cbeb3d19..d5d59235ad 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -380,10 +380,12 @@ func (s *Store) DeleteVolume(i needle.VolumeId) error {
Ttl: v.Ttl.ToUint32(),
}
for _, location := range s.Locations {
- if found, err := location.deleteVolumeById(i); found && err == nil {
+ if err := location.DeleteVolume(i); err == nil {
glog.V(0).Infof("DeleteVolume %d", i)
s.DeletedVolumesChan <- message
return nil
+ } else {
+ glog.Errorf("DeleteVolume %d: %v", i, err)
}
}