Skip to content

Commit

Permalink
fix range locking in simple obj patch
Browse files Browse the repository at this point in the history
  • Loading branch information
bttrfl authored and vitalif committed Nov 23, 2023
1 parent 4b9d8eb commit ce6e113
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -1773,15 +1773,17 @@ func (inode *Inode) flushLimitsExceeded() bool {
}

func (inode *Inode) patchSimpleObj(bufs []*FileBuffer) {
inode.LockRange(0, inode.Attributes.Size, true)
size := inode.Attributes.Size

inode.LockRange(0, size, true)
inode.IsFlushing += inode.fs.flags.MaxParallelParts
atomic.AddInt64(&inode.fs.activeFlushers, 1)

go func() {
inode.mu.Lock()
inode.patchFromBuffers(bufs, 0)

inode.UnlockRange(0, inode.Attributes.Size, true)
inode.UnlockRange(0, size, true)
inode.IsFlushing -= inode.fs.flags.MaxParallelParts
inode.mu.Unlock()

Expand Down

0 comments on commit ce6e113

Please sign in to comment.