aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2024-03-27 16:05:11 -0700
committerchrislu <chris.lu@gmail.com>2024-03-27 16:05:11 -0700
commit6aa804b368242f853b5258f20178eae8a5eda26f (patch)
tree2d1821b0127db333e77ac1a192444632a12408e6
parent36fec34c472266fe2a8f087af7de3945dc198726 (diff)
downloadseaweedfs-6aa804b368242f853b5258f20178eae8a5eda26f.tar.xz
seaweedfs-6aa804b368242f853b5258f20178eae8a5eda26f.zip
lock instead of RLock, to prevent racing condition
https://github.com/seaweedfs/seaweedfs/discussions/5432#discussioncomment-8933608
-rw-r--r--weed/mount/inode_to_path.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/weed/mount/inode_to_path.go b/weed/mount/inode_to_path.go
index 8c29ae085..2c0b7203e 100644
--- a/weed/mount/inode_to_path.go
+++ b/weed/mount/inode_to_path.go
@@ -146,8 +146,8 @@ func (i *InodeToPath) HasPath(path util.FullPath) bool {
}
func (i *InodeToPath) MarkChildrenCached(fullpath util.FullPath) {
- i.RLock()
- defer i.RUnlock()
+ i.Lock()
+ defer i.Unlock()
inode, found := i.path2inode[fullpath]
if !found {
// https://github.com/seaweedfs/seaweedfs/issues/4968