Avoid fatal error: sync: Unlock of unlocked RWMutex
fix https://github.com/chrislusf/seaweedfs/issues/3306
This commit is contained in:
@@ -18,7 +18,7 @@ type ReaderCache struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SingleChunkCacher struct {
|
type SingleChunkCacher struct {
|
||||||
sync.RWMutex
|
sync.Mutex
|
||||||
cond *sync.Cond
|
cond *sync.Cond
|
||||||
parent *ReaderCache
|
parent *ReaderCache
|
||||||
chunkFileId string
|
chunkFileId string
|
||||||
@@ -183,8 +183,8 @@ func (s *SingleChunkCacher) destroy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SingleChunkCacher) readChunkAt(buf []byte, offset int64) (int, error) {
|
func (s *SingleChunkCacher) readChunkAt(buf []byte, offset int64) (int, error) {
|
||||||
s.RLock()
|
s.Lock()
|
||||||
defer s.RUnlock()
|
defer s.Unlock()
|
||||||
|
|
||||||
for s.completedTime.IsZero() {
|
for s.completedTime.IsZero() {
|
||||||
s.cond.Wait()
|
s.cond.Wait()
|
||||||
|
|||||||
Reference in New Issue
Block a user