mirror of
https://github.com/chrislusf/seaweedfs
synced 2024-07-05 08:36:55 +02:00
ensure entry view cache is invalidated
This commit is contained in:
parent
f4ad63528a
commit
b2acfd75e9
|
@ -140,7 +140,15 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// set the new chunks and reset entry cache
|
||||||
entry.Chunks = chunks
|
entry.Chunks = chunks
|
||||||
|
file.wfs.handlesLock.Lock()
|
||||||
|
existingHandle, found := file.wfs.handles[file.Id()]
|
||||||
|
file.wfs.handlesLock.Unlock()
|
||||||
|
if found {
|
||||||
|
existingHandle.entryViewCache = nil
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
entry.Attributes.Mtime = time.Now().Unix()
|
entry.Attributes.Mtime = time.Now().Unix()
|
||||||
entry.Attributes.FileSize = req.Size
|
entry.Attributes.FileSize = req.Size
|
||||||
|
|
|
@ -147,7 +147,7 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var chunkResolveErr error
|
var chunkResolveErr error
|
||||||
if true || fh.entryViewCache == nil {
|
if fh.entryViewCache == nil {
|
||||||
fh.entryViewCache, chunkResolveErr = filer.NonOverlappingVisibleIntervals(fh.f.wfs.LookupFn(), entry.Chunks, 0, math.MaxInt64)
|
fh.entryViewCache, chunkResolveErr = filer.NonOverlappingVisibleIntervals(fh.f.wfs.LookupFn(), entry.Chunks, 0, math.MaxInt64)
|
||||||
if chunkResolveErr != nil {
|
if chunkResolveErr != nil {
|
||||||
return 0, fmt.Errorf("fail to resolve chunk manifest: %v", chunkResolveErr)
|
return 0, fmt.Errorf("fail to resolve chunk manifest: %v", chunkResolveErr)
|
||||||
|
|
Loading…
Reference in a new issue