aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/file.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-05-25 01:27:21 -0700
committerChris Lu <chris.lu@gmail.com>2018-05-25 01:27:21 -0700
commitac66c133a5a5fff9c9815a27b20d07926e214b8d (patch)
tree1f4eb0b92e0228512bd90acf5909340f9906180a /weed/filesys/file.go
parent6d1bcd4b8c9a0579d703ecae3d6d3f06bdff644b (diff)
downloadseaweedfs-ac66c133a5a5fff9c9815a27b20d07926e214b8d.tar.xz
seaweedfs-ac66c133a5a5fff9c9815a27b20d07926e214b8d.zip
do not read attributes when file is opened
Diffstat (limited to 'weed/filesys/file.go')
-rw-r--r--weed/filesys/file.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/filesys/file.go b/weed/filesys/file.go
index 09ae4c871..d63f9d62d 100644
--- a/weed/filesys/file.go
+++ b/weed/filesys/file.go
@@ -23,13 +23,14 @@ type File struct {
dir *Dir
wfs *WFS
attributes *filer_pb.FuseAttributes
+ isOpen bool
}
func (file *File) Attr(context context.Context, attr *fuse.Attr) error {
fullPath := filepath.Join(file.dir.Path, file.Name)
- if file.attributes == nil {
+ if file.attributes == nil || !file.isOpen {
item := file.wfs.listDirectoryEntriesCache.Get(fullPath)
if item != nil {
entry := item.Value().(*filer_pb.Entry)
@@ -80,6 +81,8 @@ func (file *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.Op
glog.V(3).Infof("%v file open %+v", fullPath, req)
+ file.isOpen = true
+
return &FileHandle{
f: file,
RequestId: req.Header.ID,