aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/file.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-01-20 20:21:01 -0800
committerChris Lu <chris.lu@gmail.com>2020-01-20 20:21:01 -0800
commita990ef2106a2571d0e2578eecdd856ee74986944 (patch)
tree44ac20bd9fc651da33c3171bdac2772522972eaa /weed/filesys/file.go
parent630f72f8c577fba9ca11fee7694e0748af03fadf (diff)
downloadseaweedfs-a990ef2106a2571d0e2578eecdd856ee74986944.tar.xz
seaweedfs-a990ef2106a2571d0e2578eecdd856ee74986944.zip
mount: fix problems found in issue 1182
fix https://github.com/chrislusf/seaweedfs/issues/1182 always use the non-duplicated fs.Node Forget() the fs.Node Rename will also use the right fs.Node Avoid using the same file handle for the same file
Diffstat (limited to 'weed/filesys/file.go')
-rw-r--r--weed/filesys/file.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/weed/filesys/file.go b/weed/filesys/file.go
index 622ba6f57..d811cb179 100644
--- a/weed/filesys/file.go
+++ b/weed/filesys/file.go
@@ -23,6 +23,7 @@ var _ = fs.NodeGetxattrer(&File{})
var _ = fs.NodeSetxattrer(&File{})
var _ = fs.NodeRemovexattrer(&File{})
var _ = fs.NodeListxattrer(&File{})
+var _ = fs.NodeForgetter(&File{})
type File struct {
Name string
@@ -94,11 +95,12 @@ func (file *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.Op
func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error {
+ glog.V(3).Infof("%v file setattr %+v, old:%+v", file.fullpath(), req, file.entry.Attributes)
+
if err := file.maybeLoadEntry(ctx); err != nil {
return err
}
- glog.V(3).Infof("%v file setattr %+v, old:%+v", file.fullpath(), req, file.entry.Attributes)
if req.Valid.Size() {
glog.V(3).Infof("%v file setattr set size=%v", file.fullpath(), req.Size)
@@ -208,6 +210,13 @@ func (file *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) error {
return nil
}
+func (file *File) Forget() {
+ glog.V(3).Infof("Forget file %s/%s", file.dir.Path, file.Name)
+
+ file.wfs.forgetNode(filer2.NewFullPath(file.dir.Path, file.Name))
+
+}
+
func (file *File) maybeLoadEntry(ctx context.Context) error {
if file.entry == nil || !file.isOpen {
entry, err := file.wfs.maybeLoadEntry(ctx, file.dir.Path, file.Name)