mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(flashnode): fix eof issues that could be caused by concurrent creation of cacheBlock.
close:#23100234 Signed-off-by: shuqiang-zheng <zhengshuqiang@oppo.com>
This commit is contained in:
parent
b36e228468
commit
24d656446f
@ -622,6 +622,17 @@ func (c *CacheEngine) createCacheBlock(volume string, inode, fixedOffset uint64,
|
||||
}()
|
||||
}
|
||||
|
||||
v, ok = c.keyToDiskMap.Load(key)
|
||||
if ok {
|
||||
cacheItem := v.(*lruCacheItem)
|
||||
if atomic.LoadInt32(&cacheItem.status) == proto.ReadWrite {
|
||||
if blockValue, got := cacheItem.lruCache.Peek(key); got {
|
||||
block = blockValue.(*CacheBlock)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var cacheItem *lruCacheItem
|
||||
if cacheItem, err = c.selectAvailableLruCache(); err == nil {
|
||||
block = NewCacheBlock(cacheItem.config.Path, volume, inode, fixedOffset, version, allocSize, c.readSourceFunc, clientIP)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user