Commit 91451a73 authored by hotaery's avatar hotaery Committed by Han-Wen Nienhuys

fs: update oldParent.children for exchange rename

Change-Id: I7b8d1a6be288324021c846273aceb08eb9010e98
parent 701e7fc8
......@@ -703,7 +703,7 @@ retry:
}
if destChild != nil {
oldParent.children[oldName] = oldChild
oldParent.children[oldName] = destChild
oldParent.changeCounter++
destChild.parents.add(parentData{oldName, oldParent})
......
......@@ -75,6 +75,22 @@ func TestRenameExchange(t *testing.T) {
if !reflect.DeepEqual(after2, before1) {
t.Errorf("after2, before1: %#v, %#v", after2, before1)
}
root := tc.loopback.EmbeddedInode().Root()
ino1 := root.GetChild("file")
if ino1 == nil {
t.Fatalf("root.GetChild(%q): null inode", "file")
}
ino2 := root.GetChild("dir").GetChild("file")
if ino2 == nil {
t.Fatalf("dir.GetChild(%q): null inode", "file")
}
if ino1.StableAttr().Ino != after1.Ino {
t.Errorf("got inode %d for %q, want %d", ino1.StableAttr().Ino, "file", after1.Ino)
}
if ino2.StableAttr().Ino != after2.Ino {
t.Errorf("got inode %d for %q want %d", ino2.StableAttr().Ino, "dir/file", after2.Ino)
}
}
func TestRenameNoOverwrite(t *testing.T) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment