diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-12-17 12:46:42 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-12-17 12:46:42 -0800 |
| commit | 986cbdf7d95bbb0839ab77bb7e42e4b9baad0a69 (patch) | |
| tree | 4580ab5bbfc81bd9649ab3f0e2ceb033497409f2 | |
| parent | 99990a3c911ab01aab5808ebc91b035170aa5ec6 (diff) | |
| download | seaweedfs-986cbdf7d95bbb0839ab77bb7e42e4b9baad0a69.tar.xz seaweedfs-986cbdf7d95bbb0839ab77bb7e42e4b9baad0a69.zip | |
Revert "Merge pull request #1683 from qieqieplus/master"
This reverts commit 8cb67952db822ef232dd2701ce78a5486d54b4ea, reversing
changes made to 200e56215a4fdc4ec424f05fb975cdc876d7a2b4.
| -rw-r--r-- | weed/storage/disk_location.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go index 359d0cec2..2d4d120af 100644 --- a/weed/storage/disk_location.go +++ b/weed/storage/disk_location.go @@ -99,14 +99,12 @@ func (l *DiskLocation) loadExistingVolume(fileInfo os.FileInfo, needleMapKind Ne } // avoid loading one volume more than once - l.volumesLock.Lock() - if _, found := l.volumes[vid]; found { - l.volumesLock.Unlock() + l.volumesLock.RLock() + _, found := l.volumes[vid] + l.volumesLock.RUnlock() + if found { glog.V(1).Infof("loaded volume, %v", vid) return true - } else { - l.volumes[vid] = nil - l.volumesLock.Unlock() } // load the volume @@ -115,7 +113,7 @@ func (l *DiskLocation) loadExistingVolume(fileInfo os.FileInfo, needleMapKind Ne glog.V(0).Infof("new volume %s error %s", volumeName, e) return false } - + l.SetVolume(vid, v) size, _, _ := v.FileStat() |
