Fixed build errors.
parent
99080585ce
commit
f7f7ac8ff6
|
@ -401,13 +401,9 @@ func (fs *memFS) Rename(
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
// Ask the old parent for the child's inode ID. Unlock because we need to
|
// Ask the old parent for the child's inode ID and type.
|
||||||
// lock the new parent. This should be safe without risk of the referrent of
|
|
||||||
// the name changing, because the kernel needs to hold a lock on each of the
|
|
||||||
// parents.
|
|
||||||
oldParent := fs.getInodeOrDie(op.OldParent)
|
oldParent := fs.getInodeOrDie(op.OldParent)
|
||||||
childID, childType, ok := oldParent.LookUpChild(op.OldName)
|
childID, childType, ok := oldParent.LookUpChild(op.OldName)
|
||||||
oldParent.mu.Unlock()
|
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
err = fuse.ENOENT
|
err = fuse.ENOENT
|
||||||
|
@ -427,12 +423,8 @@ func (fs *memFS) Rename(
|
||||||
op.NewName,
|
op.NewName,
|
||||||
childType)
|
childType)
|
||||||
|
|
||||||
newParent.mu.Unlock()
|
|
||||||
|
|
||||||
// Finally, remove the old name from the old parent.
|
// Finally, remove the old name from the old parent.
|
||||||
oldParent.mu.Lock()
|
|
||||||
oldParent.RemoveChild(op.OldName)
|
oldParent.RemoveChild(op.OldName)
|
||||||
oldParent.mu.Unlock()
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue