aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/disk_location.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-12-17 12:46:20 -0800
committerChris Lu <chris.lu@gmail.com>2020-12-17 12:46:20 -0800
commitf56e6d231e86ff1ca5fefcda220012ee121c88a5 (patch)
tree09cfeb880785529b2d723e24634fe4cc21172661 /weed/storage/disk_location.go
parent1bf22c0b5b1ecd99cb1631800e5a6818e8d8d1b1 (diff)
downloadseaweedfs-f56e6d231e86ff1ca5fefcda220012ee121c88a5.tar.xz
seaweedfs-f56e6d231e86ff1ca5fefcda220012ee121c88a5.zip
Revert "Merge pull request #1683 from qieqieplus/master"
This reverts commit 8cb67952db822ef232dd2701ce78a5486d54b4ea, reversing changes made to 200e56215a4fdc4ec424f05fb975cdc876d7a2b4.
Diffstat (limited to 'weed/storage/disk_location.go')
-rw-r--r--weed/storage/disk_location.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go
index 271a36ef7..6623c0111 100644
--- a/weed/storage/disk_location.go
+++ b/weed/storage/disk_location.go
@@ -101,14 +101,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