From 8e9ad7db5ac31ef38649a44a7599f6431ee616ad Mon Sep 17 00:00:00 2001 From: chrislu Date: Tue, 19 Apr 2022 22:58:57 -0700 Subject: [PATCH] fix bug deleting volume or unmount volume if a volume server has multiple directories --- weed/storage/store.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/weed/storage/store.go b/weed/storage/store.go index 30fe63b63..fa2897fbc 100644 --- a/weed/storage/store.go +++ b/weed/storage/store.go @@ -434,10 +434,13 @@ func (s *Store) UnmountVolume(i needle.VolumeId) error { } for _, location := range s.Locations { - if err := location.UnloadVolume(i); err == nil || err == ErrVolumeNotFound { + err := location.UnloadVolume(i) + if err == nil { glog.V(0).Infof("UnmountVolume %d", i) s.DeletedVolumesChan <- message return nil + } else if err == ErrVolumeNotFound { + continue } } @@ -458,10 +461,13 @@ func (s *Store) DeleteVolume(i needle.VolumeId) error { DiskType: string(v.location.DiskType), } for _, location := range s.Locations { - if err := location.DeleteVolume(i); err == nil || err == ErrVolumeNotFound { + err := location.DeleteVolume(i) + if err == nil { glog.V(0).Infof("DeleteVolume %d", i) s.DeletedVolumesChan <- message return nil + } else if err == ErrVolumeNotFound { + continue } else { glog.Errorf("DeleteVolume %d: %v", i, err) }