aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-03-29 01:39:48 -0700
committerChris Lu <chris.lu@gmail.com>2020-03-29 01:39:48 -0700
commit54768d07615a6775f59c6f2efd0f29b6b4e8a58b (patch)
tree6afc083607a46fa9693304430bcc099c9e6ed8dc /weed/filesys
parentb656e05aaf71208a7c146839b6432fe2aaaea5a6 (diff)
downloadseaweedfs-54768d07615a6775f59c6f2efd0f29b6b4e8a58b.tar.xz
seaweedfs-54768d07615a6775f59c6f2efd0f29b6b4e8a58b.zip
fix: delete a file and then create a directory with the same name
Diffstat (limited to 'weed/filesys')
-rw-r--r--weed/filesys/dir.go10
-rw-r--r--weed/filesys/file.go1
2 files changed, 10 insertions, 1 deletions
diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go
index ee3af39c5..c892b4f91 100644
--- a/weed/filesys/dir.go
+++ b/weed/filesys/dir.go
@@ -157,6 +157,8 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error) {
+ glog.V(4).Infof("mkdir %s: %s", dir.FullPath(), req.Name)
+
newEntry := &filer_pb.Entry{
Name: req.Name,
IsDirectory: true,
@@ -187,9 +189,12 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, err
if err == nil {
node := dir.newDirectory(util.NewFullPath(dir.FullPath(), req.Name), newEntry)
+
return node, nil
}
+ glog.V(0).Infof("mkdir %s/%s: %v", dir.FullPath(), req.Name, err)
+
return nil, fuse.EIO
}
@@ -285,6 +290,7 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
dir.wfs.deleteFileChunks(entry.Chunks)
dir.wfs.cacheDelete(filePath)
+ dir.wfs.fsNodeCache.DeleteFsNode(filePath)
glog.V(3).Infof("remove file: %v", req)
err = filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, false, false, false)
@@ -299,7 +305,9 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
func (dir *Dir) removeFolder(req *fuse.RemoveRequest) error {
- dir.wfs.cacheDelete(util.NewFullPath(dir.FullPath(), req.Name))
+ t := util.NewFullPath(dir.FullPath(), req.Name)
+ dir.wfs.cacheDelete(t)
+ dir.wfs.fsNodeCache.DeleteFsNode(t)
glog.V(3).Infof("remove directory entry: %v", req)
err := filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, true, false, false)
diff --git a/weed/filesys/file.go b/weed/filesys/file.go
index 7d64135b2..024e69b26 100644
--- a/weed/filesys/file.go
+++ b/weed/filesys/file.go
@@ -227,6 +227,7 @@ func (file *File) maybeLoadEntry(ctx context.Context) error {
if file.entry == nil || file.isOpen <= 0 {
entry, err := file.wfs.maybeLoadEntry(file.dir.FullPath(), file.Name)
if err != nil {
+ glog.V(3).Infof("maybeLoadEntry file %s/%s: %v", file.dir.FullPath(), file.Name, err)
return err
}
if entry != nil {