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 committed Jun 20, 2024
1 parent dcd6efe commit 6da52bd
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 @@ -168,12 +168,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 6da52bd

Please sign in to comment.