Fix a few data races when reading files in mount (#3527)

This commit is contained in:
Patrick Schmidt
2022-08-27 01:41:37 +02:00
committed by GitHub
parent f5156cf3a8
commit 5df105b1f9
6 changed files with 70 additions and 37 deletions

View File

@@ -135,10 +135,11 @@ func (wfs *WFS) maybeReadEntry(inode uint64) (path util.FullPath, fh *FileHandle
}
var found bool
if fh, found = wfs.fhmap.FindFileHandle(inode); found {
entry = fh.GetEntry()
if entry != nil && fh.entry.Attributes == nil {
entry.Attributes = &filer_pb.FuseAttributes{}
}
entry = fh.UpdateEntry(func(entry *filer_pb.Entry) {
if entry != nil && fh.entry.Attributes == nil {
entry.Attributes = &filer_pb.FuseAttributes{}
}
})
} else {
entry, status = wfs.maybeLoadEntry(path)
}