Skip to content

Commit

Permalink
vfs: fix the race of getting file length (#4876)
Browse files Browse the repository at this point in the history
  • Loading branch information
SandyXSD authored May 21, 2024
1 parent 09404aa commit ab59a43
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/vfs/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,10 @@ func (s *sliceReader) run() {
inode := f.inode
f.Unlock()

f.Lock()
length := f.length
f.Unlock()
var slices []meta.Slice
err := f.r.m.Read(meta.Background, inode, indx, &slices)
f.Lock()
length := f.length
if s.state != BUSY || f.err != 0 || f.closing {
s.done(0, 0)
}
Expand Down

0 comments on commit ab59a43

Please sign in to comment.