mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-12-17 17:51:20 +08:00
fix possible directory deletion error
This commit is contained in:
@@ -324,6 +324,10 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
|
|||||||
dir.wfs.cacheDelete(filePath)
|
dir.wfs.cacheDelete(filePath)
|
||||||
dir.wfs.fsNodeCache.DeleteFsNode(filePath)
|
dir.wfs.fsNodeCache.DeleteFsNode(filePath)
|
||||||
|
|
||||||
|
if dir.wfs.option.AsyncMetaDataCaching {
|
||||||
|
dir.wfs.metaCache.DeleteEntry(context.Background(), filePath)
|
||||||
|
}
|
||||||
|
|
||||||
glog.V(3).Infof("remove file: %v", req)
|
glog.V(3).Infof("remove file: %v", req)
|
||||||
err = filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, false, false, false)
|
err = filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, false, false, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -331,10 +335,6 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
|
|||||||
return fuse.ENOENT
|
return fuse.ENOENT
|
||||||
}
|
}
|
||||||
|
|
||||||
if dir.wfs.option.AsyncMetaDataCaching {
|
|
||||||
dir.wfs.metaCache.DeleteEntry(context.Background(), filePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -345,6 +345,10 @@ func (dir *Dir) removeFolder(req *fuse.RemoveRequest) error {
|
|||||||
dir.wfs.cacheDelete(t)
|
dir.wfs.cacheDelete(t)
|
||||||
dir.wfs.fsNodeCache.DeleteFsNode(t)
|
dir.wfs.fsNodeCache.DeleteFsNode(t)
|
||||||
|
|
||||||
|
if dir.wfs.option.AsyncMetaDataCaching {
|
||||||
|
dir.wfs.metaCache.DeleteEntry(context.Background(), t)
|
||||||
|
}
|
||||||
|
|
||||||
glog.V(3).Infof("remove directory entry: %v", req)
|
glog.V(3).Infof("remove directory entry: %v", req)
|
||||||
err := filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, true, false, false)
|
err := filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, true, false, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -352,10 +356,6 @@ func (dir *Dir) removeFolder(req *fuse.RemoveRequest) error {
|
|||||||
return fuse.ENOENT
|
return fuse.ENOENT
|
||||||
}
|
}
|
||||||
|
|
||||||
if dir.wfs.option.AsyncMetaDataCaching {
|
|
||||||
dir.wfs.metaCache.DeleteEntry(context.Background(), t)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user