From de3eb7c3801ecb837fe70dab651600190f8b5dad Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 13 Dec 2019 11:14:09 -0800 Subject: [PATCH] update cache if updating the attributes --- weed/filesys/dir.go | 4 ++-- weed/filesys/file.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go index 35ee09f2d..9f23a1132 100644 --- a/weed/filesys/dir.go +++ b/weed/filesys/dir.go @@ -337,6 +337,8 @@ func (dir *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fus dir.attributes.Mtime = req.Mtime.Unix() } + dir.wfs.listDirectoryEntriesCache.Delete(dir.Path) + parentDir, name := filer2.FullPath(dir.Path).DirAndName() return dir.wfs.WithFilerClient(ctx, func(client filer_pb.SeaweedFilerClient) error { @@ -355,8 +357,6 @@ func (dir *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fus return fuse.EIO } - dir.wfs.listDirectoryEntriesCache.Delete(dir.Path) - return nil }) diff --git a/weed/filesys/file.go b/weed/filesys/file.go index 0a0090e3d..2d4be3c80 100644 --- a/weed/filesys/file.go +++ b/weed/filesys/file.go @@ -111,6 +111,8 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f return nil } + file.wfs.listDirectoryEntriesCache.Delete(file.fullpath()) + return file.wfs.WithFilerClient(ctx, func(client filer_pb.SeaweedFilerClient) error { request := &filer_pb.UpdateEntryRequest{