Skip to content

Commit

Permalink
Fix open handle count issue with Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
jfantinhardesty committed Jan 15, 2025
1 parent 0cefa32 commit 64997fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion component/file_cache/file_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -1569,15 +1569,20 @@ func (fc *FileCache) RenameFile(options internal.RenameFileOptions) error {
return localRenameErr
}

// update any open handles to the file with its new name
if sflock.Count() > 0 {
// update any open handles to the file with its new name
handlemap.GetHandles().Range(func(key, value any) bool {
handle := value.(*handlemap.Handle)
if handle.Path == options.Src {
handle.Path = options.Dst
}
return true
})
// copy the number of open handles to the new name
for sflock.Count() > 0 {
sflock.Dec()
dflock.Inc()
}
}

return nil
Expand Down

0 comments on commit 64997fd

Please sign in to comment.