aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/file.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2022-01-17 23:04:30 -0800
committerGitHub <noreply@github.com>2022-01-17 23:04:30 -0800
commite271721d4ec04365b15be96d009e20cc6f64317e (patch)
tree233f7e5b9b96abde346504474d9e5d739d0ff3b3 /weed/filesys/file.go
parent1bd6d289d48ea3ae3c1461bf090ce0ffa6f2505f (diff)
parentb2acfd75e9155d49f32eea8d6247d0c8661ec998 (diff)
downloadseaweedfs-e271721d4ec04365b15be96d009e20cc6f64317e.tar.xz
seaweedfs-e271721d4ec04365b15be96d009e20cc6f64317e.zip
Merge pull request #2596 from chrislusf/memory_chunked_write
fix concurrency issues found in tests
Diffstat (limited to 'weed/filesys/file.go')
-rw-r--r--weed/filesys/file.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/weed/filesys/file.go b/weed/filesys/file.go
index e971aa2e0..48a024f20 100644
--- a/weed/filesys/file.go
+++ b/weed/filesys/file.go
@@ -140,7 +140,15 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f
}
}
}
+ // set the new chunks and reset entry cache
entry.Chunks = chunks
+ file.wfs.handlesLock.Lock()
+ existingHandle, found := file.wfs.handles[file.Id()]
+ file.wfs.handlesLock.Unlock()
+ if found {
+ existingHandle.entryViewCache = nil
+ }
+
}
entry.Attributes.Mtime = time.Now().Unix()
entry.Attributes.FileSize = req.Size