bazil / fuse

FUSE library for Go.  go get bazil.org/fuse  
http://bazil.org/fuse
Other
1.6k stars 266 forks source link

need help on invalidate kernel node cache or Forget() the node #271

Closed chrislusf closed 3 years ago

chrislusf commented 3 years ago

I am trying to deal with this https://github.com/chrislusf/seaweedfs/issues/1752

When a file is updated, the mount does not invalidate the kernel cache. So the file size is unchanged. I tried to use direct_io in https://github.com/bazil/fuse/issues/156 to solve this. So the cat the_file works.

However, ls -l the_file is still reporting the wrong file size. The wrong file size is failing other operations, e.g., echo something >> the_file will append at the wrong offset.

I have tried to use InvalidateNodeData and/or InvalidateNodeAttr without success. When ls -l the_file, with debug message, the correct file size is set correctly to the attr.Size in Attr(ctx context.Context, attr *fuse.Attr).

Is there any way to invalidate kernel node cache? Or some way to tell kernel to Forget the node?

chrislusf commented 3 years ago

found the problem. Need to call InvalidateEntry