mount2: fix unlink

This commit is contained in:
chrislu
2022-02-18 01:10:53 -08:00
parent 93e12d5f30
commit 63062ed7f0

View File

@@ -104,13 +104,19 @@ func (wfs *WFS) Unlink(cancel <-chan struct{}, header *fuse.InHeader, name strin
dirFullPath, code := wfs.inodeToPath.GetPath(header.NodeId) dirFullPath, code := wfs.inodeToPath.GetPath(header.NodeId)
if code != fuse.OK { if code != fuse.OK {
return if code == fuse.ENOENT {
return fuse.OK
}
return code
} }
entryFullPath := dirFullPath.Child(name) entryFullPath := dirFullPath.Child(name)
entry, status := wfs.maybeLoadEntry(entryFullPath) entry, code := wfs.maybeLoadEntry(entryFullPath)
if status != fuse.OK { if code != fuse.OK {
return status if code == fuse.ENOENT {
return fuse.OK
}
return code
} }
// first, ensure the filer store can correctly delete // first, ensure the filer store can correctly delete
@@ -119,7 +125,7 @@ func (wfs *WFS) Unlink(cancel <-chan struct{}, header *fuse.InHeader, name strin
err := filer_pb.Remove(wfs, string(dirFullPath), name, isDeleteData, false, false, false, []int32{wfs.signature}) err := filer_pb.Remove(wfs, string(dirFullPath), name, isDeleteData, false, false, false, []int32{wfs.signature})
if err != nil { if err != nil {
glog.V(0).Infof("remove %s: %v", entryFullPath, err) glog.V(0).Infof("remove %s: %v", entryFullPath, err)
return fuse.ENOENT return fuse.OK
} }
// then, delete meta cache // then, delete meta cache