Skip to content

Commit

Permalink
Try to prevent panics in case of rename conflict with some additional…
Browse files Browse the repository at this point in the history
… reproduction conditions (for #98)

Simple parallel renames of files in two mountpoints don't reproduce the panic
  • Loading branch information
vitalif committed Dec 27, 2023
1 parent 1f1f038 commit 1c65cff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,13 +837,13 @@ func (inode *Inode) sendRename() {
inode.renamingTo = false
inode.resetCache()
inode.mu.Unlock()
newParent.mu.Lock()
newParent.removeChildUnlocked(inode)
newParent.mu.Unlock()
newParent.removeChild(inode)
if oldParent != nil {
oldParent.mu.Lock()
delete(oldParent.dir.DeletedChildren, oldName)
oldParent.addModified(-1)
if _, ok := oldParent.dir.DeletedChildren[oldName]; ok {
delete(oldParent.dir.DeletedChildren, oldName)
oldParent.addModified(-1)
}
oldParent.mu.Unlock()
}
} else {
Expand Down

0 comments on commit 1c65cff

Please sign in to comment.